Skip to main content

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

Release files for log2json-fauzanelka 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for log2json-fauzanelka 0.0.4
File Size Uploaded
log2json-fauzanelka-0.0.4.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for log2json-fauzanelka 0.0.4
File Interpreter ABI Platform
log2json_fauzanelka-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / log2json-fauzanelka-0.0.4.tar.gz

Download URL log2json-fauzanelka-0.0.4.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c7e9478c05bceaa11d406826a2d5d5a6a3c4fda5bb40bd578a5cbb4296a51232
BLAKE2b-256 checksum
How to use checksums
7f4c924adfb716449a7153446f00e52cd058f0b735814ba3dbd1b46e57280189
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Release files / log2json_fauzanelka-0.0.4-py3-none-any.whl

Download URL log2json_fauzanelka-0.0.4-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcf3d99cf1b9e8566992750381bc5719d3a3cf08966d322990277b7234bff34c
BLAKE2b-256 checksum
How to use checksums
fbe7cd4f007dbf171a0945e58a9e8c88f14422bd36627c4bbc66403c89a285fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page