Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

bayashi/App-jl

Repository files navigation

This is Perl module App::jl.

SYNOPSIS

The jl command allows you to show the "JSON in JSON" log nicely. Recursively decode JSON in JSON string like below

$ echo '{"foo":"{\"bar\":\"{\\\"baz\\\":123}\"}"}' | jl
{
   "foo" : {
      "bar" : {
         "baz" : 123
      }
   }
}

A complecated log can be converted to nice JSON structure to treat a tool like jq .

echo '{"service":"Foo-Service","pod":"bar-baz-12345","message":"{\"log\":\"[PID:12345]<info>\\nThis is log message. foo, bar, baz, qux, long message is going to be splitted nicely to treat JSON by jq without any special function\",\"timestamp\":1560526739}"}' | jl -xxxx
{
   "message" : {
      "log" : [
         [
            "[PID:12345]",
            "<info>"
         ],
         [
            "This is log message. foo",
            "bar",
            "baz",
            "qux",
            "long message is going to be splitted nicely to treat JSON by jq without any special function"
         ]
      ],
      "timestamp" : "2019-06-15 00:38:59"
   },
   "pod" : "bar-baz-12345",
   "service" : "Foo-Service"
}

Make JSON in JSON logs more readable.

INSTALLATION

There are several ways to install,

1) The easiest way to install App::jl is

$ curl -L https://cpanmin.us | perl - -M https://cpan.metacpan.org -n App::jl

2) If your cpanm (cpm or CPAN) is set up, you should just be able to do

$ cpanm App::jl

3) Clone it, then build it

$ perl Makefile.PL
$ make
# make install

REPOSITORY

App::jl is hosted on github http://github.com/bayashi/App-jl

NOTICE

There is a new implementation in Go: https://github.com/bayashi/go-jl

This Perl version has been archived. Not maintained anymore. Please use Go version.

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

AUTHOR

Dai Okabayashi <bayashi@cpan.org>