ApacheLog

  • Import can read all common variants of the Apache log format, as well as Wolfram MathLM log files and user-customized log formats.

BackgroundBackground

    Apache log files.
    Native log file format of the Apache web server.
    Common variants are Apache Common Log and Apache Access Log.
    Is used by MathLM, the Wolfram System license manager.
    Plain text format.
    Stores information about web server transactions.
    Represents each record as a line of text.
    Allows user-customized record formats.

Import and ExportImport and Export

  • Import["file","ApacheLog"] imports an Apache log file.
  • Import["file","ApacheLog"] reads an Apache log file and returns the contents as a table.
  • Import["file",{"ApacheLog",elem}] imports the specified element from an Apache log file.
  • Import["file",{"ApacheLog",{elem1,elem2,}}] imports multiple elements.
  • The format must always be specified when importing Apache log files.
  • See the reference pages for full general information on Import.
  • ImportString supports Apache log formats.

ElementsElements

  • General Import elements:
  • "Elements"list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Data representation element:
  • "Data"content of the file represented as a list of lists
  • Import by default uses the element for Apache log files.
  • Selecting individual data fields:
  • "Attachments"files attached to the message
    "ByteCount"byte size of the object returned to the client
    "Date"date and time of the transaction, given as a string
    "Referrer"site the client reports having been referred from
    "RemoteHost"IP address or hostname of the client
    "RemoteUser"user ID of the client as determined by HTTP authentication
    "RequestLine"the client request as a string, normally containing the path of the requested object and information about the protocol
    "SessionID"a string that identifies the user session
    "StatusCode"the status code that the server returns to the client, as defined in the HTTP specification (RFC2616)
    "UserAgent"browser identification as reported by the client

OptionsOptions

  • Import option:
  • "DataFormat"Automaticformat specification, given as a list of data representation elements and separators representing one record
  • To import a custom log format, can be used to specify the format of each record as a combination of data elements and record separators.
  • Import of Common Log files uses the setting
  • The default format of Access Log files is given by

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Import an entire log file as a list of records:

In[1]:=
Click for copyable input
Out[1]=

Show the Import elements available in this file:

In[2]:=
Click for copyable input
Out[2]=

Read only the date fields:

In[3]:=
Click for copyable input
Out[3]=

Read all server requests:

In[4]:=
Click for copyable input
Out[4]=
Introduced in 2007
(6.0)