Analyse some log files
Project description
Log analyst
Features
- parse log files
- filters by date / timestamps
- correlates log lines (start and end of some processing)
- show total duration
- friendly colored output
- able to output short summaries
- supports gzipped files
Usage
For instance, with systemd logs:
journalctl -b 5 -o short-iso | loga -s correlators/sample.toml
Sample correlation
Note: the "loganalyst" section is a configuration, which is optional, use only in case overriding values is needed.
Find the sample correlation in correlators/sample.toml
:
[loganalyst]
# patterns required before & after the ISO date to consider the log line valid
ts_lines_prefix = ".*"
ts_lines_suffix = ""
# What will be searched for in each line to extract the ISO date
iso_regex = '(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d)'
# timezone used in dates input by the user
timezone = "CEST"
["Basic pattern-less correlation"]
start = "this is the start"
end = "end over"
["Correlation using a pattern"]
start = 'starting request (\d+)'
end = 'request (\d+) ended.'
debug = true # adds some extra verbosity, useful when making new rules
["systemd units start"]
start = 'systemd\[\d+\]: Starting (.*?)[.]+'
end = 'systemd\[\d+\]: Started (.*)\.$'
["systemd units sockets"]
start = 'systemd\[\d+\]: Listening on (.*?)[.]+'
end = 'systemd\[\d+\]: Closed (.*)\.$'
["systemd units duration"]
start = 'systemd\[\d+\]: Started (.*?) ?[.]+$'
end = 'systemd\[\d+\]: Stopped (.*)\.$'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
logAnalyst-1.0.6.tar.gz
(4.9 kB
view hashes)
Built Distribution
Close
Hashes for logAnalyst-1.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b04c1f34d06d14acf26f6ccf2d81dc0e147eeb8839a154f4bd8e342bbca3fca9 |
|
MD5 | c9606b6f6bb1a992e0cbc02d562df5d8 |
|
BLAKE2b-256 | a0ad3722a5a9acde86e2bb0f775b8731de97e86bacce77ccacc9b8713dce4f6f |