Convert log to json
Project description
log2json
Convert log file to text or json format.
Installation
This project can be installed via pip
:
pip install log2json-fauzanelka
Or build it yourself by cloning this project:
git clone https://github.com/fauzanelka/log2json
Then install
cd log2json
python setup.py install
Usage
Convert to text format
Convert log file to text (default)
log2json /var/log/nginx/access.log -o $HOME/nginx-access.txt
Convert multiple log files to text with destination directory
log2json /var/log/nginx/access.log /var/log/nginx/error.log -d $HOME/log2json/
If destination directory is not provided, the scripts will use current directory
+ log2json_output
Convert to json format
Convert log file to json
log2json /var/log/nginx/access.log -t json -o $HOME/nginx-access.json
Convert multiple log files to text with destination directory
log2json /var/log/nginx/access.log /var/log/nginx/error.log -t json -d $HOME/log2json/
Convert log file to json with regex (advanced)
log2json /var/log/nginx/access.log -t json -o $HOME/nginx-access.json -e '^(?P<remote_addr>.*?) - (?P<remote_user>.*?) \[(?P<time_local>.*)?\] \"(?P<request>.*?)\" (?P<status>\d+) (?P<body_bytes_sent>\d+) \"(?P<http_referer>.*?)\" \"(?P<http_user_agent>.*?)\" \"(?P<http_x_forwarder_for>.*?)\"$'
For further documentation you can run
log2json -h
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for log2json-fauzanelka-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb86f5ff061361b17c877683ab4cdcc41794301fefcf60b1ee1630f3287a3dc2 |
|
MD5 | 7fa2a629b732c06aa94ae79efa643ff4 |
|
BLAKE2b-256 | 38d4c8de7ee04d3c4f7b3fb5157ff521ad78f2eb804157f1d49607c980d9223a |
Close
Hashes for log2json_fauzanelka-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 299db42298a01301a6737be25d9c02078d3d794c54e5fe4434137a2b137b476b |
|
MD5 | 6797c438fe96cb20af82c44a415f54a7 |
|
BLAKE2b-256 | 553ee5ee454e87a44ba0b41d390bac41ae60b010cacfa1686c7daec40bc76f52 |