Artifact [b4e5d0b6d7]
Artifact b4e5d0b6d7882fb8952a4c405b490872f3f544bf678ee930188d1a4b8b9b131f:
- File logfmt1/docs/logex.md — part of check-in [33aecba645] at 2020-12-28 12:59:08 on branch trunk — Add docs for logfmt1 (user: mario size: 1255)
logex
logex
is a little command line tool around logopen()
.
It basically allows fetching individual fields from a log, and/or
restructuring it into a specific format (e.g. tab or comma-delimited).
logex access.log @request_uri @datetime @user_agent
Where the first param is always the log file, and then an arbitrary number of field names - either individually or as part of a string argument:
logex access.log --tab "uri,date,status" user_agent
(Would delimit the first three per comma, the last with a tab.)
Flags
param | desc |
---|---|
--json | output each row as JSON |
--csv | join all fields with comma |
--tab | tab-separated output |
--iso8601 | fix any datetime fields |
--regex | just output regex for log |
--debug | debug_rx in case the regex fails |
Pefixes
The argument list allows field name prefixes. Which are only relevant to container-fields (expanded key:value pairs for some application formats), in case they're holding lists.
prefix | output |
---|---|
@name | will just show the first entry |
%name | space-separated list |
*name | comma-separated list |
+name | plus-joined list |
#name | as json array |
name | whatever |