Skip to main content

Apache Common/Combined Log Format Parser

Project description

Apache Common/Combined Log Parser

Parses Apache common/combined web log format records.

Returns either a dictionary representing the entire record or a list of specified objects.

To use:

from clfparser import CLFParser

test='10.223.157.186 - - [15/Jul/2009:14:58:59 -0700] "GET /favicon.ico HTTP/1.1" 404 209'

#return dictionary
clfDict=CLFParser.logDict(test)

#return list containing host, log time and a datetime object representing the log time
clfList=CLFParser.logParts(test, '%h %t %time')

Common Log Format

Described by:

"%h %l %u %t \"%r\" %>s %b"

Where:

%h - host %l - identity %u - userid %t - time %r - request %>s - status %b - size

Combined Log Format

As Common Log Format with the addition of 2 further fields:

"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""

Where:

%{Referer}i - HTTP request header referer %{User-agent}i - HTTP request header user agent

Additional Fields

In addition to the standard log fields, clfparser also parses the log time field, %t, to create a Python datetime object %time and a string object representing the timezone, timezone.

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

clfparser-0.2.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file clfparser-0.2.tar.gz.

File metadata

  • Download URL: clfparser-0.2.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for clfparser-0.2.tar.gz
Algorithm Hash digest
SHA256 a2e81ba6e73f3c4478eeca883d0c0ac3df20b4c2d1de5963d4624195ae843ab3
MD5 e07ac462b4bf4bcba16e88f8cdb98cf4
BLAKE2b-256 7707ebb2638c3f4b06dd69ea1a1ea6db5523ea1e42124695947cb257868839b0

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