Skip to main content

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

log2json-fauzanelka-0.0.4.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

log2json_fauzanelka-0.0.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file log2json-fauzanelka-0.0.4.tar.gz.

File metadata

  • Download URL: log2json-fauzanelka-0.0.4.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for log2json-fauzanelka-0.0.4.tar.gz
Algorithm Hash digest
SHA256 c7e9478c05bceaa11d406826a2d5d5a6a3c4fda5bb40bd578a5cbb4296a51232
MD5 8d12b7c80618893a0d92963cfa8c3d34
BLAKE2b-256 7f4c924adfb716449a7153446f00e52cd058f0b735814ba3dbd1b46e57280189

See more details on using hashes here.

File details

Details for the file log2json_fauzanelka-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: log2json_fauzanelka-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for log2json_fauzanelka-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dcf3d99cf1b9e8566992750381bc5719d3a3cf08966d322990277b7234bff34c
MD5 ca992239eeffd3a2d7e2a8568af09e27
BLAKE2b-256 fbe7cd4f007dbf171a0945e58a9e8c88f14422bd36627c4bbc66403c89a285fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page