Return to
Portfolio

108.9. File Lists (xm_filelist)

The xm_filelist module can be used to implement file-based blacklisting or whitelisting. This extension module provides two functions, contains() and matches(), that can be invoked to check whether the string argument is present in the file. This can be a username, IP address, or similar. Each referenced file is cached in memory and any modifications are automatically loaded without the need to reload NXLog.

108.9.1. Configuration

The xm_filelist module accepts the following directives in addition to the common module directives. The File directive is required.

File

The mandatory File directive specifies the name of the file that will be read into memory. This directive may be specified more than once if multiple files need to be operated on.


CheckInterval

This optional directive specifies the frequency with which the files are checked for modifications, in seconds. The default value is 5 seconds. File checks are disabled if CheckInterval is set to 0.

108.9.2. Functions

The following functions are exported by xm_filelist.

boolean contains(string str)

Check if line in the file(s) contains the string str.

boolean contains(string str, boolean caseinsensitive)

Check if line in the file(s) contains the string str. May be case insensitive according to caseinsensitive.

boolean matches(string str)

Check if a line in the file(s) matches the string str.

boolean matches(string str, boolean caseinsensitive)

Check if a line in the file(s) matches the string str. May be case insensitive according to caseinsensitive.