Git Product home page Git Product logo

jl's Introduction

jl — JSON Logs

Go Report Card

jl is a development tool for working with structured JSON logging.

Modern applications quite often use structured logging instead of simple log messages. This is preferable for computer systems but not for humans. jl will help development by translating structured message into old-fashioned log lines.

Examples

A code snippets says more than a thousand words:

$ myprogram
{"message": "Hello, world!!", "severity": "info"}
{"message": "skipping file", "severity": "warn", "file": "empty.txt"}

$ myprogram | jl
   INFO: Hello, world!!
WARNING: skipping file [file=empty.txt]

(more examples)

Installation

macOS:

$ brew install koenbollen/public/jl
$ echo '{"msg": "It works!"}' | jl
It works!

Linux:

$ curl -LO https://github.com/koenbollen/jl/releases/download/v1.4.0/jl_linux_amd64
$ sudo install jl_linux_amd64 /usr/bin/jl && rm jl_linux_amd64
$ echo '{"msg": "It works!"}' | jl
It works!

Others:

Alternatively you can fetch a binary from the latest release or install the latest development version from source: go install github.com/koenbollen/jl@latest (requires Go 1.17+).

Usage

Usage:
  jl [options] [FILE...]

Options:
  -h, --help    Show this screen.
  --version     Show version.

Output Options:
  --color           Force colorized output
  --no-color        Don't colorize output
  --skip-prefix     Skip printing truncated bytes before the JSON
  --skip-suffix     Skip printing truncated bytes after the JSON

Formatting Options:
  --skip-fields     Don't output misc json keys as fields
  --include-fields  <fields>, -f <fields> Always include these json keys as fields (comma seperated list)

You can add any option to the JL_OPTS environment variable, ex:
  export JL_OPTS="--no-color"

Compatibility

jl tries to dynamically parse the lines to support as many well known formats as possible.

Is jl not compatible with your structured logging? Please let me know by creating an issue.

jl's People

Contributors

koenbollen avatar nordicdyno avatar dependabot[bot] avatar dmitry-cherkas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.