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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7e9478c05bceaa11d406826a2d5d5a6a3c4fda5bb40bd578a5cbb4296a51232 |
|
MD5 | 8d12b7c80618893a0d92963cfa8c3d34 |
|
BLAKE2b-256 | 7f4c924adfb716449a7153446f00e52cd058f0b735814ba3dbd1b46e57280189 |
Close
Hashes for log2json_fauzanelka-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcf3d99cf1b9e8566992750381bc5719d3a3cf08966d322990277b7234bff34c |
|
MD5 | ca992239eeffd3a2d7e2a8568af09e27 |
|
BLAKE2b-256 | fbe7cd4f007dbf171a0945e58a9e8c88f14422bd36627c4bbc66403c89a285fa |