Skip to main content

Parse log file as input and export the data to database as output.

Project description

logio

Parse log file as input and export the data to database as output.

Install

pip install logio

Installed Command Utils

  • logio

Usage

C:\Workspace\logio>logio --help
Usage: logio [OPTIONS] COMMAND [ARGS]...

  Parse log file as input and export the data to database as output.

Options:
  -c, --config TEXT  Config file path. The config file must in yaml format.
                     [required]

  --help             Show this message and exit.

Commands:
  scan    Try example settings on a test file.
  server  Start log handler server.
  test    Parse the example text and print out parse result.

Settings

  • input
    • type: stdin, file, tail
    • ignore-blank-lines: true, false
    • encoding: utf-8, gb18030, ...
    • for type=file
    • filename
    • for type=tail
    • filename
    • offset-file
    • read-from-end
    • backup-patterns
    • sleep-interval
    • non-blocking
    • blocking
  • output
    • type: mysql, stdout, print-not-matched-line
    • buffer-size
    • for type=mysql
    • ignore-not-matched-lines
    • keep-failed-lines
    • inserts: list<string, string>
      • key: DEFAULT, some other key
      • sql_template
  • parser
    • type: regex, json
    • keeep-not-matched-lines: bool
    • for type=regex
    • use-default-rules
    • transforms
    • rules
    • matches: list<string, string>
      • matched_name
      • regex

Example config

input:
  type: tail
  filename: tests\nginx.access.log
parser:
  type: regex
  matches:
    simple: "{SIMPLE_NGINX_ACCESS}"
  transforms:
    - field: time_local
      type: strftime
      strptime: "%d/%b/%Y:%H:%M:%S %z"
    - field: request_time
      type: str2number
    - field: request_time
      type: formula
      formula: "{request_time} * 1000000"
    - field: request_time
      type: int
output:
  type: mysql
  mysql:
    host: 127.0.0.1
    port: 3306
    user: root
    password: password
    database: database
  inserts:
    simple:
      sql: insert into table_name (add_time, path, response_time) values (%s, %s, %s)
      fields:
        - time_local
        - request_path
        - request_time

Releases

v0.1.19 2022/01/18

  • Add sympy in requirements.txt.
  • Remove mysqlclient from requirements.txt.
  • Fix license file missing problem.

v0.1.18 2021/02/22

  • Set default buffer-size to 10.
  • Add log in loop.
  • Use fastutils.logutils.setup.

V0.1.13 2021/02/18

  • Add Nginx Access Log Rules.
  • Add LogFilter subsystem.
  • Add transforms support in LogParser.

v0.1.10 2020/10/10

  • Add json parser.

v0.1.9 2020/09/10

  • Change package's home url.

v0.1.8 2020/09/09

  • Translate help informations to english.
  • Add License.
  • Add LogToStdout.

v0.1.7

  • Some bad old release, ignore them...

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

logio-0.1.19.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

logio-0.1.19-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file logio-0.1.19.tar.gz.

File metadata

  • Download URL: logio-0.1.19.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for logio-0.1.19.tar.gz
Algorithm Hash digest
SHA256 f917bda1cdfca6247d9d0195e5f84d4403c81de4b08431120fd9ace3bc2e9910
MD5 5262836abbc620ff0a93a31cd0433af2
BLAKE2b-256 473faf5fc4d173fa54f4159b34080db54b5c6944af96c9380afccbaac125a4a3

See more details on using hashes here.

File details

Details for the file logio-0.1.19-py3-none-any.whl.

File metadata

  • Download URL: logio-0.1.19-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for logio-0.1.19-py3-none-any.whl
Algorithm Hash digest
SHA256 25f5743814ea55ac407c68ef0da9c6f68f30aa2379443df63bc63290abad671e
MD5 6e502410bca1bc48a33c91b446adc454
BLAKE2b-256 874947c5fdf5d3a0eead13d525bd3f5db52cd069e3eb14e38286e7cbb5847ae7

See more details on using hashes here.

Supported by

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