parse-syslog-line.pl - Parse a syslog message and display the structured data
version 4.5
Use this utility to parse syslog lines to arbitrary formats.
tail -1 /var/log/messages | parse-syslog-line.pl
For help, see:
parse-syslog-line.pl --help
Use parse-syslog-line.pl as a way to do things with jq:
parse-syslog-line.pl
tail /var/log/messages | parse-syslog-line.pl --json |jq '.program_name'
Attempt to extract all structured data in the log:
tail /var/log/messages | parse-syslog-line.pl --sdata --json |jq '{ program: .program_name, sdata: .SDATA }'
See all the keys available,
tail /var/log/messages | parse-syslog-line.pl --all
Output Pretty JSON:
tail -1 /var/log/messages | parse-syslog-line.pl --pretty
Output prettier JSON:
tail -1 /var/log/messages | parse-syslog-line.pl --json | jq '.'
Output as YAML:
tail -1 /var/log/messages | parse-syslog-line.pl --yaml
Brad Lhotsky <brad@divisionbyzero.net>
This software is Copyright (c) 2017 by Brad Lhotsky.
This is free software, licensed under:
The (three-clause) BSD License
To install Parse::Syslog::Line, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parse::Syslog::Line
CPAN shell
perl -MCPAN -e shell install Parse::Syslog::Line
For more information on module installation, please visit the detailed CPAN module installation guide.