Skip to content

Forza-tng/logparse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

logparse

Logparse is a shell script that parses Caddy JSON log files and outputs them as formatted text. It supports the Common Log Format and Combined Log Format, usually used by traditional HTTP servers like Apache, however it is easy to customise the output using the --selector option.

The config file allows for changing default output format, add additional selectors and adapt logparse to other JSON sources. Logparse uses the powerful jq tool to process the JSON files.

Requirements

  • Bash 5.1: Logparse is using associative arrays which is not available in plain POSIX shell scripts.
  • jq 1.7: Tested with jq 1.7.1.

Usage

Usage: logparse [-c | -C | -s sel] [-F <file>] [-l] [-t <num> [-f]] filename
Options:
  -c, --common              Apache Common Log Format (default).
  -C, --combined            Apache Combined Log Format.
  -s, --selector            Selector list, comma-separated: sel1,sel2,sel3
                            multiple -s is allowed; lists are concatenated.
  -F, --config-file         Use a configuration file.
  -t, --tail <num>          Output the last NUM lines from log file (default: 15).
  -f, --follow              Continuously monitor log file for new entries.
  -l, --list-selectors      List all available selectors and exit.
  -h, --help                Show this help message and exit.

Examples

Example usage and descriptions is available on the wiki https://wiki.tnonline.net/w/Linux/logparse

About

Logparse is a shell script that parses Caddy's JSON log files and outputs them as formatted text. https://wiki.tnonline.net/w/Linux/logparse

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages