Group
Extension

Matches 2

App-jl ( B/BA/BAYASHI/App-jl-0.20.tar.gz, BAYASHI, 2021; MetaCPAN )
App-jl/README.pod ( view source; MetaCPAN )

=end html


=head1 SYNOPSIS

The B<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}\"}
{
             "baz" : 123
          }
       }
    }

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

    echo '{"service":"Foo-Service","pod":"bar-baz-12345",
>\\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
    {
       "messag
App-jl ( B/BA/BAYASHI/App-jl-0.20.tar.gz, BAYASHI, 2021; MetaCPAN )
App-jl/lib/App/jl.pm ( view source; MetaCPAN )
package App::jl;
use strict;
use warnings;
use JSON qw//;
use Sub::Data::Recursive;
use B;
use Getopt::Long qw/GetOptionsFromArray/;

our $VERSION = '0.20';

my $MAX_RECURSIVE_CALL = 255;

my $MAYBE_U
 my $opt = $class->_parse_opt(@argv);

    my $self = bless {
        _opt  => $opt,
        _json => JSON->new->utf8->pretty(!$opt->{no_pretty})->canonical(1),
        __current_orig_line => undef,
 
Keys = 1;
    }
}

sub _process {
    my ($self) = @_;

    my $decoded = eval {
        $self->{_json}->decode($self->{__current_orig_line});
    };
    if ($@) {
        return $self->{__current_ori

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.