ygrok - Build YAML by parsing lines of plain text
version 0.034
ygrok [-l|--loose] <pattern> [<file>...] ygrok --pattern [<pattern_name> [<pattern>]] yfrom -h|--help|--version
This program takes lines of plain text and converts them into documents.
The pattern to match with. Any line that does not match the pattern will be ignored.
See the full documentation for pattern syntax.
A file to read. The special file "-" refers to STDIN. If no files are specified, read STDIN.
Match anywhere in the line. Normally, the pattern must match the full line. Setting this allows the pattern to match anywhere in the line (but still only once).
View, add, and edit patterns. With no arguments, shows all the patterns. With pattern_name, shows the specific pattern or pattern category. With pattern, adds a custom pattern that can then be used in future patterns.
pattern_name
pattern
# Show all patterns ygrok --pattern # Show all "NET" patterns ygrok --pattern NET # Show the "NET.HOSTNAME" pattern ygrok --pattern NET.HOSTNAME # Add a new pattern ygrok --pattern HOSTS_LINE '%{NET.HOSTNAME:host} %{NET.IPV4:ip}' # Use the new pattern ygrok '%{HOSTS_LINE}' < /etc/hosts
Show this help document.
Print the current ygrok and Perl versions.
A pattern is a match for the entire line, splitting the line into fields.
A named ygrok match has the format: %{PATTERN_NAME:field_name}. The PATTERN_NAME is one of the available patterns, listed below. The field_name is the field to put the matched data.
%{PATTERN_NAME:field_name}
PATTERN_NAME
field_name
Additionally, the pattern is a Perl regular expression, so any regular expression syntax will work. Any named captures ((?<field_name>PATTERN)) will be part of the document.
(?<field_name>PATTERN)
The built-in patterns are common patterns that are always available.
A single word, \b\w+\b.
\b\w+\b
A non-slurpy section of data, .*?.
.*?
An integer, positive or negative.
A floating-point number, positive or negative, with optional exponent.
A full or abbreviated month name for the "C" locale (January (Jan), February (Feb), etc...)
An ISO8601 date/time
An RFC822 date/time, used by HTTP.
A syslog date, like "Jan 01 01:23:45"
A username.
A process name
An IPv4 address.
An IPv6 address.
A network host name. Either an RFC1101 domain or an IPv4 or IPv6 address.
A full URL with scheme
The path part of a URL
The Apache Common Log Format.
The Apache Combined Log Format.
The syslog format (RFC 3164)
Parse the output of ls -l
ls -l
Parse the output of ps
ps
Parse the output of ps x and ps w
ps x
ps w
Parse the output of ps u
ps u
Specify the default format Yertl uses between commands. Defaults to yaml. Can be set to json for interoperability with other programs.
yaml
json
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2016 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install ETL::Yertl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ETL::Yertl
CPAN shell
perl -MCPAN -e shell install ETL::Yertl
For more information on module installation, please visit the detailed CPAN module installation guide.