The Log File Parser Definition page defines templates and parameters used to parse log files. Definitions are subsequently assigned to machine IDs using the Log Parser page. Log parsers are initially private, but can be shared with other users.
The Log File Parsing Cycle
The parsing of a log file is triggered whenever the log file is changed. In most cases this involves appending new text to the end of the file. To avoid scanning the entire log file from the beginning each time the file is updated, the agent parses log files as follows:
Note: The parsing of a log file is not a procedure event itself. Only a new configuration, or reconfiguration, using Log Parser, Assign Parser Sets or Parser Summary generates a procedure you can see in the Procedure History or Pending Procedure tabs of the Machine Summary page.
Save
Select Save to save changes to a log file parser definition.
Save As...
Select Save As... to save a log file parser definition under a different name.
Delete
Select Delete to delete a log file parser definition.
Share...
You can share log file parser definitions you own with other VSA users, user roles, or make the procedure public to all users.
Parser Name
Enter the name of the parser.
Log File Path
Enter the full UNC pathname or mapped drive pathname on the target machine of the log file you want to parse. You can use asterisk (*) or question mark (?) wildcards to specify a set of log files. If a log file set is specified, the log parser starts with the latest log file first. Example: \\morpheus\logs\message.log
or c:\logs\message.log
. When specifying a UNC path to a share accessed by an agent machine—for example \\machinename\share
—ensure the share's permissions allow read/write access using the agent credential specified for that agent machine in Agent > Manage Agents.
Log Archive Path
Enter the full UNC pathname or mapped drive pathname on the target machine of the archive files you want to parse. You can use asterisk (*) or question mark (?) wildcards to specify a set of archive files. If an archive set is specified, the log parser starts with the latest log file first. Example: If message.log
is archived daily to a file in messageYYYYMMDD.log
format, then you can specify c:\logs\message*.log
. When specifying a UNC path to a share accessed by an agent machine—for example \\machinename\share
—ensure the share's permissions allow read/write access using the agent credential specified for that agent machine in Agent > Manage Agents.
Description
Enter a description for the log parser.
Template
The template is used to compare with the log entry in the log file to extract out the required data into parameters. Parameters are enclosed with $ character in template.
Enter a pattern of text and log file parameters. This pattern is used to search from the beginning of each line in a log file. If a pattern finds a match in the log file, the log file parameters in the pattern are populated with the values extracted from the log file.
You can use a percent (%) wildcard to specify an alphanumeric string of any length. A log file parameter is bracketed with the dollar ($) symbol. Enter $$ to match a pattern of text containing a $ symbol. Enter %% to match a pattern of text containing a % symbol.
Note: Template text patterns are case sensitive.
Example
126 Oct 19 2007 12:30:30 127.0.0.1 Device0[123]: return error code -1!
$EventCode$ $Time$ $HostComputer$ $Dev$[$PID$]:%error code $ErrorCode$!
EventCode=126
Time= 2007/10/19 12:30:30 Friday
HostComputer=127.0.0.1
Dev=Device0
PID=123
ErrorCode=-1
Guidelines
Skipping Characters
To skip characters, use $[n]$
, where n
is the number of characters to skip. Use $var[n]$
to retrieve a fixed number of characters to be a variable value.
Example
0123456789ABCDEFGHIJ
$[10]$ABC$str[3]$
str
is DEF
.Multilayer Template
If checked, multiple lines of text and log file parameters are used to parse the log file.
Note: The character string {tab}
can be used as a tab character and {nl}
can be used as a new line break. {nl}
cannot be used in single line template. %
can be used as wildcard character.
Output Template
Enter a pattern of text and log file parameters to store in Log Monitoring.
Example:
Received device error from $Dev$ on $HostComputer$. Code = $ErrorCode$.
Received device error from Device0 on 127.0.0.1. Code = -1.
Apply
Click Apply to add or update a parameter entered in the Name field.
Clear All
Click Clear All to remove all parameters from the parameter list.
Log File Parameters
Name
Once the template is created, you need to define the list of parameters used by the template. All the parameters in the template have to be defined, otherwise the parser returns an error. Available parameters are integer, unsigned integer, long, unsigned long, float, double, datetime, string. The length of parameter name is limited to 32 characters.
Enter the name of a parameter used to store a value. Parameters are subsequently used in the Template and Output Template text boxes.
Note: Do not bracket the name of the parameter with $ symbols in the Name field. This is only required when the parameter is entered in the Template and Output Template text boxes.
Type
Enter the data type appropriate for the parameter. If data parsed from a log file cannot be stored using that data type, the parameter remains empty.
Date Format
If the Type selected is Date Time
, enter a Date Format.
yy, yyyy, YY, YYYY
- two or four digit yearM
- single or two digit monthMM
- two digit monthMMM
- abbreviation of month name, ex. "Jan"MMMM
- full month name, ex. "January"D, d
- single or two digit dayDD, dd
- two digit dayDDD, ddd
- abbreviation name of day of week, Ex. "Mon"DDDD, dddd
- full name of day of week, ex. "Monday"H, h
- single or two digit hourHH, hh
- two digit hourm
- single or two digit minutemm
- two digit minutes
- single or two digit secondss
- two digit secondf
- one or more digit of fraction of secondff
- fffffffff - two to nine digitt
- one character time mark, ex. "a"tt
- two-character time mark, ex. "am"Note: Date and time filtering in views and reports are based on the log entry time. If you include a $Time$
parameter using the Date Time
data type in your template, Log Monitoring uses the time stored in the $Time$
parameter as the log entry time. If a $Time$
parameter is not included in your template, then the time the entry was added to Log Monitoring serves as the log entry time. Each date time parameter must contain at least the month, day, hour, and second data.
Example:
Oct 19 2007 12:30:30
MMM DD YYYY hh:mm:ss
UTC Date
Log Monitoring stores all date/time values as universal time, coordinated (UTC). This enables UTC date and times to be automatically converted to the user's local time when Log Monitoring data is displayed or when reports are generated.
If blank, the date and time values stored in the log file parameter are converted from the local time of the machine ID assigned the log parser to UTC. If checked, the date and time values stored in the log file parameter are UTC and no conversion is necessary.