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=' - - [15/Jul/2009:14:58:59 -0700] "GET /favicon.ico HTTP/1.1" 404 209'

#return dictionary

#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"


%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\""


%{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.

Files for clfparser, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size clfparser-0.2.tar.gz (2.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page