logparse/README.md

38 lines
1.4 KiB
Markdown
Raw Normal View History

2024-05-27 22:09:15 +02:00
```text
_
| |
| | ___ __ _ _ __ __ _ _ __ ___ ___
| |/ _ \ / _` | '_ \ / _` | '__/ __|/ _ \
| | (_) | (_| | |_) | (_| | | \__ \ __/
|_|\___/ \__, | .__/ \__,_|_| |___/\___|
__/ | |
|___/|_|
```
2024-05-26 22:57:15 +02:00
# logparse
2024-05-27 22:09:15 +02:00
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
```text
Usage: /usr/bin/logparse [-c | -C | -s "selectors"] [-F <config_file>] filename
Options:
-c, --common Apache Common Log Format (default)
-C, --combined Apache Combined Log Format
-s, --selector Use a space separated list of selectors
-F, --config-file Use a configuration file
-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