Configuration file

The following section describes how you could implement custom configuration file to enable logging for KAV SDK, and describes settings you could use in the configuration file to tailor logging to your environment.

To implement logging configuration:

  1. Navigate to the folder with your executable or service hosting process and create a new ASCII text document there.
  2. Name the created document as kave.ini; the name is important and must not be changed.
  3. Copy the sample configuration below to the created file and configure the copied settings to your needs.
  4. Wait for some time until configuration settings are applied.

The kave.ini configuration file consists of sections, properties and values that these properties can take. Structure of the file confirms to standard format of INI file that follows the entity-attribute-value model (EAV). Typical INI file looks as follows:

[Section]

Property=value #comment

Logging configuration file here has a single entity, a section that contains attributes, or properties, and their values. Properties characterize the entity where their values characterize properties themselves. In KAV SDK all the properties pertain to a single section called Logging.

Depending on the platform on which you use the KAV SDK, a set of properties may vary; some properties are applicable for Windows platform where others may be used only on a UNIX-like systems such as distributions of Linux, see section "System requirements" for more details about supported platforms. For example, there is no syslog daemon on Windows platform, hence the Syslog property is only supported on UNIX-like platforms. Information about what properties can be used is listed later in this section.

The following table describes in properties of the logging configuration file.

Configuration file properties

Property

Description

Append

Specifies if previous log files are kept intact or are deleted on each initialization of KAV Engine.

The SDK checks for the value of the Append option when loading KAV Engine.

Possible values:

  • 0

    Automatically remove existing log files.

    Existing log files in the log folder are automatically removed when KAV SDK is initialized. Log files are kept per session and are replaced with new files when a new scanning session starts.

  • 1

    Keep existing log files.

    Tracing information will be output to new LOG files each corresponding to a specific process. The option does not make the SDK to append tracing information to an existing log. This option allows you to collect LOG files or multiple scanning sessions keeping the log files created in previous scanning sessions.

    Supported platform: all platforms supported by KAV SDK.

SizeLimit

Sets the limit, in Mbytes, for the maximum size of the log file.

Possible values:

Any positive integer in the range 0 to 4095 with border values being:

  • 0

    No limit. The log file can grow unlimited.

  • 4095

    The maximum log file size is limited to 2**12-1 Mbytes, and the file can grow up until nearly 4 Gbytes.

Setting the limit to a non-zero value automatically turns on append mode regardless of the value specified for the Append property.

Supported platform: Windows. This parameter is ignored on UNIX-like platforms.

WriteLog

Level of logging detail specifying how much tracing data is output.

Possible values:

  • 0

    Logging is turned off.

  • 1

    Turns on simplified logging mode that is scarce on tracing details, but usually is a good balance for detail and amount of tracing parameters being enough to serve for regular monitoring of KAV SDK workflow.

  • 9

    Turns on full logging which is useful for debugging purposes. This logging mode may be used to collect detailed tracing data for sending it to Kaspersky Lab representative should you experience issues integrating KAV SDK into your solution.

    Supported platform: all platforms supported by KAV SDK.

LogsFolder

Path to store log files.

This parameter specifies a path at which to store the log files.

When specifying paths, please obey the conventions of the target platform, e.g. make sure to use backward slashes as path separators on Windows platform, and use forward slashes to separate directories on UNIX-like platforms.

Do not enclose path in quotes and do not escape the space character. Long path with spaces are good to go unless they exceed the MAX_PATH limitation.

Possible values:

  • Relative path

    A path with root calculated related to the folder containing kave.ini configuration file.

    When using this type of paths, please make sure to verify that the destination folder exists prior to initializing KAV SDK with logging settings, otherwise no logging will be made. The KAV SDK product does not automatically create the storage folder if it is missing from the specified location.

  • Absolute path

    A path that specifies root for the location where you want the log files to be stored.

    When using this type of paths, please make sure to verify that the destination folder exists prior to initializing KAV SDK with logging settings, otherwise no logging will be made. The KAV SDK product does not automatically create the storage folder if it is missing from the specified location.

  • Local path

    Location of kave.ini. A local path can be specified by either setting the value of LogsFolder parameter to "." (without quotes) or leaving the value blank.

    When local path is specified, log files are stored in the program folder of the scanning process.

The full custom path for the LOG files must not exceed the limit of 260 characters, applied by MAX_PATH macro.

This integer number does not include additional length restrictions such as null terminator used in C strings and other restriction imposed by platforms such as when the file system stores additional short name in 8.3 format with the original file name for sake of compatibility with obsolete applications.

Supported platform: all platforms supported by KAV SDK.

Syslog

Output logging data to a system log maintained by Syslog daemon.

When using Syslog, you may want to output logging data to log files, other programs, or redirect them to another host, as configured the configuration file for the Syslog daemon.

This logging feature is supported for the the in-process, out-of-process and service modes of integration. Logging detail is maintained by the WriteLog parameter of the kave.ini log configuration file of KAV SDK.

Possible values:

  • 0

    No output to Syslog. Logging data is output directly to the location specified in the LogsFolder parameter.

  • 1

    Logging data is redirected to Syslog daemon and stored at the location specified in the configuration file of Sylog daemon. The value of LogsFolder parameter is ignored.

Before you use output to Syslog, make sure to configure syslog daemon for debug logging. Add the following line to the syslog.conf configuration file:

*.=debug -/var/log/debug

Syslog configuration file is typically located at /etc/syslog.conf and controls the output of syslogd daemon.

Supported platform: UNIX-like platforms with installed Syslog daemon. This parameter is not supported on Windows platform.

Remarks

Log files are created per session. When a new scanning session starts, that is the kaveInitizlizeEx function returns, a new a log file is created at the location specified by LogsFolder. Each log file is given the name of the the INI configuration file and is postfixed with the process ID (PID). Postfixing is done to distinguish between log files for specific processes when simultaneous scanning is made and several scanner processes start in a single scanning session.

Changes to kave.ini configuration file take effect at the runtime of KAV SDK. You can alter the configuration parameters any time while KAV SDK is running without having to re-initialize the SDK. The SDK polls the file for changes so that they take effect automatically in a few seconds when values are altered.

When using append logging mode, several features must be noted. If the KAV SDK library is initialized in out-of-process mode a separate log file is created for each started process of KAV SDK. Because the out-of-process integration mode implies that all scanning processes are arbitered by a monitoring process. Thus, for n started scanning there is a yet on single arbiter process. This results in n+1 started process pertaining to KAV SDK. A separate log file is for each of such processes effectively giving n+1 log files that are created for such a scanning session (n is the number of scanning kavehost processes started by the parent, called arbiter, process).

The parent process arbiters scanning tasks between your client and scanning processes of KAV SDK. All the information regarding the tasks managed by the arbiter process, interprocess communications management modules (kavessi and ipclib libraries), dispatcher module (kavesd library), and a module interfacing to your client application (kave8 library) is output to the file referenced by the PID of the arbiter process.

Information about processing of scanning tasks issued by the arbiter process and the KAV Engine is stored in the log files each referring to a specific scanning process. This data contains messages from the ipclib interprocessing module, the hosting process for the KAV Engine (the kavehost executable), and the control module of scanning meachanism (the kavess library). Such log files are postfixed with the PID of their related kavehost host processes.

In some cases, your Technical Account Manager may ask you to enable advanced logging. Advanced logging may help Kaspersky Lab specialists investigate troublesome issues.

To enable advanced logging:

  1. Open the kave.ini file (create a new one in the folder with kavehost binary if needed)
  2. In the Logging section add the BssLogsFolder option and specify a location to store the files with advanced logging data.

    This must be a separate location than your standard logging data location (specified in LogsFolder).

Examples

The following example lists a sample configuration file for each of the target platforms. You can find properties described in the table in this section.

The following sample configuration file may be used on Windows platform.

Example:

[LOGGING]

SizeLimit=0

WriteLog=9

Append=0

LogsFolder=.\logs

The following sample configuration file may be used on a UNIX-like platform.

Example:

[LOGGING]

WriteLog=9

Append=0

LogsFolder=./logs

Syslog=0

Page top