Show/Hide Toolbars

MonitorWare Agent

Navigation: Configuring MonitorWare Agent > Services

File Monitor

Scroll Prev Top Next More

The file monitor monitors the content of a text file just as the event monitor monitors the Windows event log. Its purpose is to gather vital information that is stored in system text files. Many applications do not write events to the event log but to a text file. This is also the case with many Microsoft applications (for example the WINS log).


The file monitor can also gather Internet Information Server (Windows' web server) log files. This is very useful for monitoring web activity and detecting attacks.


General Tab



Figure 1: General Options



File and path name

File Configuration fields:



Here, you must type the name of the file to be monitored. To select a file from any specified location, press the browse button. Once a complete file name is specified, exactly that file is monitored.


The file name is never changed automatically. However, many systems generate changing log files. For example, Internet Information Server (IIS) can be configured to change the log file every day. Therefore, each day's log file has a different name.


To support changing log file names, there are replacement characters available within the file name. These are:





Year with two digits (e.g. 2002 becomes "02")


Year with 4 digits


Month with two digits (e.g. March becomes "03")


Minute with two digits


Day of month with two digits (e.g. March, 1st becomes "01")


Hour as two digits


Seconds as two digits. It is hardly believed that this ever be used in reality.        


Weekday as one digit. 0 means Sunday, 1 Monday and so on.


Weekday as three-character string. Possible values are

"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat".

This replacement character is most useful for DHCP log files.


It contains the fully generated filename (Can be useful for filtering).


Only available if enable in the advanced option of the File Monitor. This value contains the current used messageseperator. This is usefull if you want to reconstruct messages where the seperator is part of the message.


Only available if enable in the advanced option of the File Monitor. This value contains the last used messageseperator. This is usefull if you want to reconstruct messages where the seperator is part of the message.

Character Replacement Table


Please note: the replacement characters are case sensitive!


For example, daily Internet Information Server log files are named "exyymmdd.log", with yy being the 2 digit year, mm the month and dd the day of month. To generate the same name with file monitor, use the following name "ex%y%m%d.log".


Please note that there is no replacement character for the monthly week number (1st week, 2nd week). As such, the weekly log file setting of IIS is not supported.


TimeMode Used for Filename

File Configuration fields:



Select the time mode used for the log file to be monitored with this drop-down list. Available options are:


1. Local Time: log file is monitored based on local time.

2. UTC: log file is monitored based on universal coordinated time. UTC was formerly referred to as "GMT" (Greenwich Mean Time) and is the basis of the international time zone system.        


Allow Directories or read multiple files

File Configuration fields:



This is the new Multiple Files feature which means you can now read an array of files. This will require a wildcard in the filename. If using directories, the amount of subdirectories is unlimited.


Use Wildcard in Filename

File Configuration fields:



This option allows you use * as random character sequence in the filename.

Please note: this character can only be used in Filename and not in the filepath.


Keep reading the current opened file until a new is created

File Configuration fields:



This has been added to define if the Service shall continuously read an open logfile until a new file (depending on the configured filename) is available. This Options is helpful for such cases where you don't know when a new logfile is generated and the old one is closed.


Report an Error if the File was not found

File Configuration fields:



As the name says, if this setting is enabled, an error is reported in the Windows Eventlog if the file was not found.


Skip all lines on Startup

File Configuration fields:



If this option is enabled, the File Monitor will skip all new lines of a logfile during startup. This will work in singlefile mode as well as multifile mode.


Probe Interval

File Configuration fields:



This interval is in miliseconds. After the specified interval the file monitor checks the file for new records.


We recommend a value of 60000 milliseconds for the "Check Interval". With that setting, the file monitor checks for new records every 60 seconds. Larger periods can be specified for occasionally connected systems or if email delivery with few emails per day is intended.


Very security-aware environments might use a shorter interval. The MonitorWare Agent 3.0 is specifically designed to limit the burden on the monitored system. As such, resource usage is typically low, even with frequently run file monitor checks. However, we recommend not running the file monitor more often than once a second.


Overrun Prevention Delay

File Configuration fields:



This property allows configuring a delay after generating an event. The time for the delay is in miliseconds.


If run at a value of zero, the Service will process events as fast as the machine permits. We have seen scenarios where routers and receivers are not able to keep up with this rate, resulting in packet loss. In addition, the CPU of the reporting machine may be higher which is not a problem for most common multicore machines in these days. However, with even a 1-millisecond delay, there is no noticeable CPU activity even when large bursts of events are forwarded. At one millisecond, the Service can still generate about 500-1000 events per second.


The default setting is an overrun protection of five millisecond, which allows roughly 200 events per second. This should be sufficient for even very busy servers.
If you need realtime event reporting, we recommend to set the value to 0.


Logfile Type

File Configuration fields:

0 = Standard (Default)

1 = W3CLog


Select the type of the log file to be monitored with this drop-down list. Available options are:


- Standard - a standard text log file

- W3C Web Server logfile - log files in the W3C web server compliant format.        


Delay writing Last File Position

File Configuration fields:



Enables a writeback delay for the Last File Position. When processing large logfiles, we would recommend to enable this feature.


Save after amount of processed lines

File Configuration fields:



When Delay writing Last File Position is enabled, the Last File Position will be written after the amount of processed lines

that are specified here.



Advanced Options Tab



Figure 2: Advanced Options


Message processing related options


Max Bytes per Message

File Configuration fields:



Maximum value of bytes that the file monitor reads per line. If a message is larger then this value, the message splits into multiple parts.


Ignore empty lines

File Configuration fields:



As the name allready says, this option discards empty lines within the logfile.


Process rest of file as one message

File Configuration fields:



When enabled, file monitor will consider the rest of a file as single message if no other message separator matches anymore.


Read Filebuffer size

File Configuration fields:



File Monitor reads files in chunks (blocks). You can define the size of these chunks here. Please note that when using regex message separators, you may need to increase the Filebuffer size to the maximum possible length of a single logline.


Character processing related options


Compress spaces

File Configuration fields:



This option compresses sequences of spaces found inside the message to a single one.


Remove Control Characters

File Configuration fields:



Removes control characters like CR and LF(carriage return and line feed).


Remove leading space

File Configuration fields:



If there are any leading spaces in the file, this option removes them.


Replace NULL Bytes with spaces

File Configuration fields:



If this option is enabled, the FileMonitor will replace NULL Bytes within files with spaces. These spaces again can be compressed with the "Compress spaces" options.



Message Separators Tab



Figure 3: Message Separators



Message separation sequence

File Configuration fields:



Defines a customizable separation sequence by which the file monitor splits messages.

If using multiple separation sequences, the comparison operation will be held as an OR operation. That means, that either this value or another value has to be true, so a message can be split. This is especially important for logfiles with different log formats.


To date, the following control characters are available:




carriage return


line feed


Enable Regular Expression

File Configuration fields:



When enabled, the Message separation sequence will be handeled as regular

expression. Everything known in the regular expression syntax can be used to

define a matching pattern.


Here are some regular expressions samples:


Regular Expression: [0-9]{4,4}-[0-9]{1,2}-[0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}

Matches typical Date like 2015-11-20 12:11:01


Regular Expression: \n[0-9]{4,4}

Matches Linefeed and 4-digit number.


Regular Expression: (;|:)

Matches semicolon or a colon.


More samples and details about the Regular Expression Syntax can be found here:


Save Message Seperator in Property

If this option is enabled, the current and last used message seperator will be saved into the properties %msgsep% and %msgseplast%.


When using regular expression as message separators, it might be needed to append or prepend the message separator to the message itself. For these cases, we have multiple way to do this:


Do not include message separator in message  

File Configuration fields:

nPropertyMsgSep = 0


Message Separator will not be included in the message


Prepend found separator to message  

File Configuration fields:

nPropertyMsgSep = 1


When enabled, the current found message separator will be prepended to the message.


Append found separator to message  

File Configuration fields:

nPropertyMsgSep = 2


When enabled, the current found message separator will be appended to the message.


Prepend previous found separator to message  

File Configuration fields:

nPropertyMsgSep = 3


When enabled, the previous found message separator will be prepended to the message.


Reset Message Seperator after each run

File Configuration fields:



If enabled, the message seperator values will be resetted after the File Monitor has finished a run (reached the end of a file).



Processed Files Tab


On this tab you see all files in a datagrid that file monitor has yet processed. Select a file within this grid to see its data values like the last file position.



Figure 4: Processed Files


Last File Position

File Configuration fields:

nLastPos [Data Value]


This is the last file (Byte) position that the File Monitor processed. Lower or Reset the Position Counter if you want to reprocess the file partially or even fully.


The data values can be controlled using the Reload File Counter Positions and Reset All Position Counters buttons, or simply by editing the Last File Position field. When saving applied changes to the data values, the service will reload them during next check interval and reprocess files if necessary.


W3C Header Value

File Configuration fields:

szW3CHeader [Data Value]


If logfile type is set to “W3C Webserver Logfile”, this value will be filled with a list of field types taken from the W3C Field header.



General Values (Common settings for most services)



Figure 5: General Values


Syslog Facility

File Configuration fields:



The Syslog facility to be assigned to events created by this service. Most useful if the message is to forward to a Syslog server.


Syslog Priority

File Configuration fields:



The Syslog priority to be assigned to events created by this service. Most useful if the message is to forward to a Syslog server.


Resource ID

File Configuration fields:



The Resource ID to be assigned to events created by this service. Most useful if the message is to forward to a Syslog server.


Syslog Tag Value

File Configuration fields:



The Syslog tag value to be assigned to events created by this service. Most useful if the message is to forward to a Syslog server.


Rule Set to Use

File Configuration fields:



Name of the rule set to be used for this service. The Rule Set name must be a valid Rule Set.



Additional articles

monitoring IIS logs