Provide a way to prioritize log file names supplied on the command line over those supplied via configuration

Issue #8 closed
StoneSteps repo owner created an issue

Traditionally, The Webalizer processed the implicitly supplied configuration file first and then command line arguments, one of which could be -c-, which names a configuration file. Each of these configuration mechanisms could supply a log file name and the next processed option would overwrite the previous one.

When a new feature was added to Stone Steps Webalizer to process multiple load-balanced logs in one run, no mechanism was provided to prioritize which log files to process when log file names were supplied in the configuration and on the command line and all supplied log files were just queued for processing and if the same log file was added more than once, it would yield double counts.

Distinguish log file names supplied through the configuration and on the command line and provide a mechanism to process only one of those sets of log file names

Comments (6)

  1. StoneSteps reporter

    Log file names are collected from three distinct sources:

    • LogFile variables in the default configuration file and its includes.
    • Command line, configuration files specified with the -c option and its includes.
    • If the --pipe-log-names option was used, log file names are read from the standard input.

    If a log file name is found in any of the sources above, the previous set of log file names is cleared, which prevents a possibility of the same log file name accepted for processing more than once if it was referenced in different parts of the configuration.

    For example, if log files 'A' and 'B' are specified in webalizer.conf, and log files C and D are specified on the command line, then only C and D will be processed.

  2. StoneSteps reporter

    Changes for this issue also alter how configuration is processed. Since v3.x, command line options were processed first and then, and only if no -c options were found in the command line, the default configuration file (webalizer.conf) and its includes were processed. After the changes for this issue, the order of processing is changed as follows:

    • The default configuration file (`webalizer.conf) is processed
    • Configuration files included in the default configuration file are processed
    • Command line options, intermixed with additional configuration files referenced via one or more -c options are processed
    • Configuration files included in command line configuration files are processed

    If a single configuration value, such as TopURLs, is found more than once while processing these steps, its value is overwritten every subsequent time. If a cumulative configuration value, such as IgnoreURL, is found multiple times, each subsequent value is added to the existing set of values.

    LogFile is different from other options in that is handled as described in the comments above this one.

  3. Log in to comment