Updating With Advanced Command Line Options

The update.php script is a command line tool that you can run to update the data from your website log files into the Logaholic database. When running update.php from the command line, there are a number of additional options you can use to change the default behavior of the script to match your specific needs.

This article assumes that you have read the basic instructions for running automated updates from the command line.

The following general syntax for passing options to the PHP script can be used for all of the command line options listed below:

php update.php “conf=%red%profilename%%&key=value&key=value&key=value”

Options can be strung together as they would appear in a browser’s address bar, with the the entire query string enclosed between double quotes.

Each of the options below may be combined with any other. Options given here can overrule the profile’s default settings, but are only applied while this update is running. They are not saved.

Advanced options:

forcetrue or false– This option controls if Logaholic checks for the most recent entry in the database and only imports data that is newer than that date. If force = true Logaholic will import any data, regardless of the date. Use this carefully, because Logaholic might import files that are already in the database (which can cause inflated statistics)
– Default is false
movedonetrue or false– When this option is set to true, Logaholic assumes there is a directory called “done” inside the directory that holds the log files. When processing of a log file in the main directory is complete, the file is moved to the “done” directory.
– Default is false
The following options all temporarily override the profile’s default settings:
logfilefullpathstring– The directory path to the folder containing the log files
splitlogs0 or 1– 0 = logfilefullpath points to a single file
– 1 = logfilefullpath points to a directory containing multiple log files
recursive0 or 1– 0 = Only files in logfilefullpath will be analyzed
– 1 = Logaholic will recusively search logfilefullpath for log files
splitfilterstring– Only file names that match string will be analyzed
string may also be a regular expression, as long as it is enclosed in parenthesis
splitfilternegativestring– File names that do not match string will be analyzed
– can be used to exclude certain files that match splitfilter conditions
skipipsstring– A comma separated list of IP numbers that should be skipped (i.e not included in the statistics)
skipfilesstring– A comma separated list of file extensions that should be skipped (i.e not included in the statistics)
urlparamfilterstring– A comma separated list of query parameters that should be removed (or included) from your urls
urlparamfiltermodeInclude or Exclude– Determines whether urlparamfilter is a list of parameters that should be included or if it is a list that should be excluded
– When set to “Include”, all parameters that do not match the list are removed!
– Default: Exclude
googleparamsstring– A comma separated list of query parameters that are stored for requests from google.
– Any parameter not in this list will be removed

For a more complete description of some of these settings, please read this article.

Example 1

You want to analyze all files in the /var/www/logs/ directory, but only file names that match “.log”, but not “error”:

php update.php “conf=profilename&logfilefullpath=/var/www/logs/&splitlogs=1&splitfilter=.log&splitfilternegative=error”

Example 2

Some log files were not included during regular updates and now there is a ‘gap’ in your statistics. You already have statistics for January and March in the database, but you are missing the data for February. You have placed the log files for February in a separate directory (e.g. /var/www/logs/feb/ ) and now want to analyze them:

php update.php “conf=profilename&logfilefullpath=/var/www/logs/feb/&splitlogs=1&force=true”

Related Topics: