You can also re-map the field names by subclassing (or clobbering) the
alias method.
-This module provides three of the most common log formats in the
-formats dictionary;
+This module provides some common log formats in the ``FORMATS``
+dictionary;
>>> # Common Log Format (CLF)
>>> p = apachelog.parser.Parser(apachelog.parser.FORMATS['common'])
>>> p = apachelog.parser.Parser(apachelog.parser.FORMATS['vhcommon'])
>>> # NCSA extended/combined log format
>>> p = apachelog.parser.Parser(apachelog.parser.FORMATS['extended'])
+>>> # Nginx log format (extended + "$gzip_ratio")
+>>> p = apachelog.parser.Parser(apachelog.parser.FORMATS['nginx'])
For some older notes regarding performance while reading lines from a
file in Python, see `this post`__ by Fredrik Lundh. Further
'vhcommon':r'%v %h %l %u %t \"%r\" %>s %b',
# NCSA extended/combined log format
+ # (common + "%{Referer}i" + "%{User-Agent}i")
'extended':r'%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"',
+
+ # Nginx default log format (extended + "$gzip_ratio")
+ 'nginx':r'%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{gzip-ratio}i\"',
}