Crates.io | log_parser_kma |
lib.rs | log_parser_kma |
version | 0.1.3 |
source | src |
created_at | 2024-11-13 18:58:25.35756 |
updated_at | 2024-11-13 23:28:57.814765 |
description | Rust-based log file parser, helping extract datetime, log levels and messages |
homepage | |
repository | |
max_upload_size | |
id | 1446934 |
size | 35,879 |
Log Parser is a simple Rust-based log file parser that uses pest
crate to parse log files, helping with extracting datetime, log levels and messages.
Log Parser can be used to extract logs with specified log level
into another file OR/AND into json
format using serde
.
Logs are parsed in the following format: Date Time Level Message
.
YYYY-MM-DD
format, e.g. 2024-11-07
.HH:MM:SS
format, e.g. 15:41:07
.INFO
, WARNING
, ERROR
.Log parser can be used via CLI (created using clap
) with the following options:
log_parser_kma parse -f <file_path> -o <output_path> [options]
-f, --file <file_path>
- specifies the path to the log file to be parsed. (Required)-o, --output <output_path>
- specifies the path to the output file. (Required)-l, --level <log_level>
- specifies log level to filter by (INFO
, WARNING
or ERROR
). (Optional)-j, --to-json
- outputs the logs in JSON format instead of plain text. (Optional)Parse a log file and save output as JSON
log_parser_kma parse -f logs.log -o results.txt -j
Parse a log file, filter ERROR
level logs and output as JSON
log_parser_kma parse -f newlogs.log -o errorlogs.txt -l ERROR -j
log_parser_kma help
log_parser_kma credits