Code Monkey home page Code Monkey logo

accesslog-parser's Introduction

AccessLog Parser and CLI

Web server access log parser and CLI tool with added features for web archive replay logs.

Installation

This package requires Python 3.6 or above. Install the latest version of the released package and accesslog CLI tool from PyPi:

$ pip install accesslog

Alternatively, build and install the development version of the package:

$ git clone https://github.com/oduwsdl/accesslog-parser.git
$ cd accesslog-parser
$ python3 setup.py install
$ accesslog --version

Input Parsing

TODO

Record Filtering

TODO

Output Formatting

TODO

CLI Reference

$ accesslog -h
usage: accesslog [options] [FILES ...]

A tool to parse Common Log formatted access logs with various derived fields.

positional arguments:
  files                 Log files (plain/gz/bz2) to parse (reads from the STDIN, if empty or '-')

optional arguments:
  -h, --help            Show this help message and exit
  -v, --version         Show version number and exit
  -d, --debug           Show debug messages on STDERR
  -e FIELDS, --nonempty FIELDS
                        Skip record if any of the provided fields is empty (comma separated list)
  -i FIELDS, --valid FIELDS
                        Skip record if any of the provided field values are invalid
                        ('all' or comma separated list from 'host,request,status,size,referrer')
  -m FIELD~RegExp, --match FIELD~RegExp
                        Skip record if field does not match the RegExp (can be used multiple times)
  -t TFORMAT, --origtime TFORMAT
                        Original datetime format of logs (default: '%d/%b/%Y:%H:%M:%S %z')
  -f FORMAT, --format FORMAT
                        Output format string (see available formatting fields below)
  -j FIELDS, --json FIELDS
                        Output NDJSON with the provided fields (use 'all' for all fields except 'origline')

formatting fields:
  {origline}            Original log line
  {host}                IP address of the client
  {identity}            Identity of the client, usually '-'
  {user}                User ID for authentication, usually '-'
  {origtime}            Original date and time (typically in '%d/%b/%Y:%H:%M:%S %z' format)
  {epoch}               Seconds from the Unix epoch (derived from origtime)
  {date}                UTC date in '%Y-%m-%d' format (derived from origtime)
  {time}                UTC time in '%H:%M:%S' format (derived from origtime)
  {datetime}            14 digit datetime in '%Y%m%d%H%M%S' format (derived from origtime)
  {request}             Original HTTP request line
  {method}              HTTP method (empty for invalid request)
  {path}                Path and query (scheme and host removed, empty for invalid request)
  {prefix}              Memento endpoint path prefix (derived from path)
  {mtime}               14 digit Memento datetime (derived from path)
  {rflag}               Memento rewrite flag (derived from path)
  {urir}                Memento URI-R (derived from path)
  {httpv}               HTTP version (empty for invalid request)
  {status}              Returned status code
  {size}                Number of bytes returned
  {referrer}            Referer header (empty, if not logged)
  {agent}               User-agent header (empty, if not logged)
  {extras}              Any additional logged fields
Default FORMAT: '{host} {date} {time} {method} {path} {status} {size} "{referrer}" "{agent}"'

accesslog-parser's People

Contributors

ibnesayeed avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.