Module parse :: Class Parser
[hide private]
[frames] | no frames]

Class Parser

source code

This class provides functionality to parse the server log file and insert it into sqlite database. Database table is deleted during creation of the each instance of this class

Instance Methods [hide private]
 
__ParseTest__(self)
This file is generated during the testing of logfile parsing.
source code
 
__Testparsedate__(self)
This file is generated during the testing of datetime parsing.
source code
 
__init__(self, logfilename=None, dbfilelocation=None)
This constructor creates an instance of Parser class.
source code
 
__parseDateTime__(self, logLine)
This class is used to parse the date and time from the line of logfile.
source code
 
parseLines(self, logLines)
This function takes iteratable collection of lines from server log file.
source code
Method Details [hide private]

__ParseTest__(self)

source code 

This file is generated during the testing of logfile parsing. Intended for internal use

Returns:
Nothing

__Testparsedate__(self)

source code 

This file is generated during the testing of datetime parsing. Intended for internal use

Returns:
Nothing

__init__(self, logfilename=None, dbfilelocation=None)
(Constructor)

source code 

This constructor creates an instance of Parser class. It require two parameters server log file path and database file location

Parameters:
  • logfilename - path of server log file
  • dbfilelocation - location of the sqlite database file to create database

__parseDateTime__(self, logLine)

source code 

This class is used to parse the date and time from the line of logfile. Intended for the internal use

Parameters:
  • logLine - a line of logfile
Returns:
python datetime object

parseLines(self, logLines)

source code 

This function takes iteratable collection of lines from server log file. It returns the list of tuples in format t(ip,datetime,request-method,request-path,request-param,user-agent,status-code,bytesTx,referrer)

Parameters:
  • logLines - iteratable collection of lines from server log file
Returns:
list of tuples