maillogger
Analysis tool for Postfix log in /var/log/maillog
Feature
- Load maillog file
- Identify text or gzip automatically
- Parse maillog
- Use regex
- Convert to Python dictionary
- Output the parsed maillog to files
- Supported data format is CSV, TSV and JSON
- Compression (gzip) is possible
Installation
pip install maillogger
Usage
usage: maillogger [-h] [-f {csv,tsv,json}] [-c] [-V] source_file target_file
Analysis tool for Postfix log in /var/log/maillog
positional arguments:
source_file Specify Postfix maillog file
target_file Specify the filename to write parsed maillog. The file
extension is automatically added to the end of
filename.
optional arguments:
-h, --help show this help message and exit
-f {csv,tsv,json}, --format {csv,tsv,json}
File data format to write the parsed maillog (Default:
csv)
-c, --compress Compress the output file with gzip
-V, --version Show maillogger command version
Examples
Output a CSV file
maillogger /var/log/maillog result
or
maillogger /var/log/maillog result -f csv
Then, result.csv is generated in current working directory.
Output a JSON file
maillogger /var/log/maillog result -f json
Output a TSV file
maillogger /var/log/maillog result -f tsv
Output a compressed CSV file
maillogger /var/log/maillog result -f csv -c
Then, result.csv.gz is generated in current working directory.
Use Case
Analysis using MySQL
- Convert maillog text to CSV file
maillogger /var/log/maillog /path/to/any -f csv
- Create Table
CREATE TABLE maillog
(
mail_id VARCHAR(15) NOT NULL,
to_address VARCHAR(50) NOT NULL,
relay text,
delay VARCHAR(10),
delays VARCHAR(20),
dsn VARCHAR(10),
status VARCHAR(10),
description text,
datetime DATETIME NOT NULL,
PRIMARY KEY (mail_id, datetime),
INDEX i_status(status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- Load CSV file
LOAD DATA INFILE '/path/to/any.csv'
IGNORE INTO TABLE maillog
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
Metadata
Release files for maillogger 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| maillogger-0.2.0.tar.gz | 7.4 kB | Without provenance | Details for maillogger-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| maillogger-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for maillogger-0.2.0-py3-none-any.whl |
Total release size: 15.9 kB
Release files / maillogger-0.2.0.tar.gz
| Download URL | maillogger-0.2.0.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed955cb9aac03b99b3e4f7bad6c3bc12339cdfb5abb54367599c1bcf4e5d3ccc
|
|
BLAKE2b-256 checksum How to use checksums |
cfa27783c35b676e2bb4cc6c20f2ab87698e7f52fe7dc244ca954e7f63b86122
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.10 CPython/3.8.5 Linux/5.3.0-1034-azure
|
Release files / maillogger-0.2.0-py3-none-any.whl
| Download URL | maillogger-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
117968bd7fa78364b037a23edb953df5fe8dec2a80833118f9b6b754d85ce0e2
|
|
BLAKE2b-256 checksum How to use checksums |
682bcc1775eec3db82c9c4646b086687e44c166ef86fb45474eda1c3d30c1ed5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.10 CPython/3.8.5 Linux/5.3.0-1034-azure
|
Security for maillogger 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.