In order to bill for the different usage RODOPI has to import information from different types of log files or other sources. The ability to import such data is implemented with so called UsageFilters. The UsageFilter is CGI application, which generates XML reports. RODOPI calls the UsageFilter in two ways within a session. First call is to retrieve a list of existing logs (or other sources of information). Following calls are to retrieve data from each log. Importing sessions are scheduled in RODOPI. Each call to a UsageFilter comes with two sets of parameters – internal parameters and additional parameters.
You can define additional parameters for your UsageFilter from Administration – Usage Filters – Filter Parameters page. First add new usage filter definition and after this add as many parameters as you wish for this usage filter. The name of the parameter will be used as name in name=value pairs in CGI request to your filter.
Each filter installation should be defined in Administration – Usage Filters – Filter Installations page. Find the table for your filter and add new installation. The URL you are entering should point to your usage filter CGI. RODOPI will use this URL to call the usage filter adding different parameters after the URL (i.e. GET method is used).
After the installation is added you should add one or more logs to this installation. Usually the log is URL to directory where log files are created, but you can use this parameter to pass different kind of data to your usage filter. When you enter installation logs and click on Add button you will see two sets of parameters.
First set defines the usage log itself. Directory URL is path (can be file path, network path, ftp location, etc.) to the place where logs reside. If you are using special sources of data you can use this parameter to specify the source. Mask is additional parameter to the URL that can be used to select only part of all logs within the location. Delay is the delay between two importing sessions and next run specifies when the next session starts.
Second set of parameters is for additional parameters you defined for this filter. The values you specify here will be used as value in name=value pairs in CGI request to your filter. It is good idea to specify a parameter for maximum count of records transmitted during one session. This way you will reduce system overheads and improve performance of imports.
Using installation settings RODOPI will start new importing session with your filter at specified time.
First call to your filter will include all additional parameters plus parameters:
ACTION=GETFILELIST
DIRECTORYURL=URL
FILEMASK=Mask
Values for above parameters are coming from the log definition. The response to this call should be an XML text in format:
|
<?xml version="1.0" ?> <RODOPI VERSION="5.1"> <FILELIST> <FILE URL="LogFileIdentificator1" CREATION="YYYYMMDDhhmmss" MODIFIED="YYYYMMDDhhmmss" SIZE="nnnn" /> <FILE URL="LogFileIdentificator2" CREATION="YYYYMMDDhhmmss" MODIFIED="YYYYMMDDhhmmss" SIZE="nnnn" /> </FILELIST> </RODOPI> |
Where:
|
URL |
identificator
of each log matching requested parameters |
|
CREATION |
log’s creation time |
|
MODIFIED |
log’s last modification time |
|
SIZE |
log’s size |
All those parameters will be stored from RODOPI and will be used when querying your logs for data in order to avoid duplication of usage records.
After the first call RODOPI will start calling your usage filter requesting for data from each log specified in the first response. The calls will include all additional parameters plus parameters:
ACTION=PARSEFILE
FILEURL=LogFileIdentificator
OFFSET=nnnn
NEXTLINE=llll
TAG=value
Where:
|
LogFileIdentificator |
is the log’s identificator as listed in the response for the first call |
|
OFFSET=nnnn |
Specifies the offset in the log file reached at last call |
|
NEXTLINE=llll |
Specifies the line of log file received at last call |
|
TAG=value |
Containg the TAG value received at last call |
The response to this call should be an XML text in format:
|
<?xml version="1.0" ?> <RODOPI VERSION="5.1"> <TABLE ID="NETTRAFFIC"> <TR OFFSET="0" LINE="1"> <TD ID="LOGDATETIME">14/July/2000 17:07:42</TD> <TD ID="IP">208.137.249.70</TD> <TD ID="PORT">0</TD> <TD ID="BYTES">19986</TD> </TR> <TR OFFSET="46" LINE="2"> <TD ID="LOGDATETIME">14/July/2000 17:07:42</TD> <TD ID="IP">208.137.249.150</TD> <TD ID="PORT">0</TD> <TD ID="BYTES">639896</TD> </TR> <TAG>NewTagValue</TAG> <MOREDATA/> </TABLE> <TABLE ID="WEBTRAFFIC"> <TR OFFSET="0" LINE="1"> <TD ID="SERVER">www.server1.com</TD> <TD ID="DATE">14/July/2000 17:07:42</TD> <TD ID="BYTES">19986</TD> <TD ID="HITS">10</TD> </TR> <TAG>NewTagValue</TAG> <MOREDATA/> </TABLE> </RODOPI> |
Each TR item contains all fields for one record of usage. Currently RODOPI uses two types of usage records – Net traffic and Web traffic. Additional usage types can be added easily when needed.
The values for OFFSET, LINE and TAG will be used when RODOPI calls your filter next time. You can use these values to avoid usage record duplications. RODOPI will continue to call your usage filter until the response sent doesn’t contain any MOREDATA items. Thus you can use additional parameter MaxCount to limit the number of records transferred at one time and send MOREDATA until all records are sent.