Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

oderwat/nu_plugin_logfmt

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nu Plugin Logfmt

Overview

The nu-plugin-logfmt is a Nushell plugin that allows conversion between logfmt (a key=value format used by some logging systems) and Nushell values. The plugin provides two commands:

  1. from logfmt: Converts a logfmt string to a Nushell record.
  2. to logfmt: Converts a Nushell record to a logfmt string.

Steps to Install

Ensure you have Go installed on your system. You can download it from here.

go install github.com/oderwat/nu_plugin_logfmt@latest
plugin add ~/go/bin/nu_plugin_logfmt
plugin use logfmt

or move it to your nushell plugins directory if you have one for that.

Usage

from logfmt Command

The from logfmt command converts a logfmt string to a Nushell record.

If the --typed flag is given. The function detect simple types.

Syntax:

<logfmt_string> | from logfmt [--typed]

Example:

'msg="Test message" level=info esc="» Say \"Hello\""' | from logfmt

Output:

{
  "level": "info",
  "msg": "Test message",
  "esc": "» Say \"Hello\""
}

to logfmt Command

The to logfmt command converts a Nushell record to a logfmt string.

Syntax:

<record> | to logfmt

Example:

{ "msg": "Hello World!", "Lang": { "Go": true, "Rust": false } } | to logfmt

Output:

msg="Hello World!" Lang.Go=true Lang.Rust=false

License

Distributed under the MIT License. See LICENSE for more information.

About

A simple from / to logfmt plugin for nushell

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.