Use dynamic file name support to specify a file name pattern
instead of an actual file name.
Some application programs create an output file name that
is subject to change. The name changes based on specific criteria
such as the current day, month, year, or a file name that includes
an incrementing sequence number. In these cases, you can specify
the file name pattern instead of the actual file name. There are two
pattern formats that are recognized when you specify the file name
pattern:
- Regular Expressions (preferred).
- IBM® Tivoli® Universal Agent dynamic file name syntax
(deprecated).
Regular expression file name
patterns
To specify file name patterns, you can use regular
expressions according to the International Components for Unicode
(ICU) syntax that is documented in (ICU regular expressions). To use this capability,
you must select the File names match regular expression check box on the Advanced Log File Attribute Group Information page. When you specify regular expression patterns, you must also
select an option from the When Multiple Files Match list on the Advanced Log File Attribute Group Informationpage to specify the guidelines for selecting the most current matching
file.
Note: Regular expressions is the preferred
method to specify file name patterns.
For more information
about how to configure advanced log file attribute group properties,
see (Monitoring a log file), Step
(6). For example, if you specified a file name pattern:
d:\program files\logs\tivoli.*
This pattern searches
for file names that start with tivoli in the d:\program files\logs directory. Regular expressions can
be specified only for the file name portion, and not the path name.
Dynamic
file name syntax
With the dynamic file name syntax, only
one file at a time can be monitored. The File Data Provider inspects
all files in the designated path location, seeking files that match
the defined pattern. The File Data Provider always monitors the most
current matching file that is based on whichever matching file name
has the highest number or date-time value. The appropriate file to
monitor is determined by file name, instead of by file creation or
other criteria.
Patterns can be specified for file names with
any number of parts. For example, Log{###} matches
on one-part file names such as Log010 or Log456. In multi-part file names, pattern characters
can be specified in any part of the file name or in multiple parts.
For example, aaa.bbb{???}.ccc is a valid pattern,
and aaa.bbb{???}.ccc{###} is also valid.
Note: Regular expressions rather than dynamic file name syntax
is the preferred method to specify file name patterns, for more about
regular expressions, see
Regular expression file name patterns
The
following examples illustrate file name pattern specification:
- {########}.abc
- Matches numeric file names of length 8 and the file extension .abc, such as 10252006.abc or 10262006.abc. File 10262006.abc is monitored because 10262006 is greater than 10252006.
- {########}.*
- Matches numeric file names of length 8 and ignores the file extension.
Examples include 20061025.log, 20061101.log, and 10252006.abc. File 20061101.log is monitored because 20061101 is the largest number.
- {######??}.abc
- Matches numeric file names of length 8 and file extension .abc, and ignores the last two positions in the name portion.
Examples include 02110199.abc, 02110200.abc, and 021101AZ.abc. File 02110200.abc is monitored because 021102 is the largest number.
- Console.{######}
- Matches file names that contain Console in the name portion and a six-digit number in the extension
portion. Examples include Console.000133, Console.000201, and Console.000134. File Console.000201is monitored.
- IN{######}.log
- Matches file names that start with IN followed
by six numerals and the file extension .log.
Examples include IN021001.log, IN021002.log, and IN021004.log. File IN021004.log is monitored.
- PS{###}FTP.txt
- Matches file names that start with PS followed
by three numerals, followed by FTP, and the extension .txt. Examples include PS001FTP.txt, PS005FTP.txt, and PS010FTP.txt. File PS010FTP.txtis monitored.
Follow these guidelines to establish file name
patterns:
- Use braces {} to enclose pattern characters in a file name. The
presence of pattern characters inside braces indicates that a file
name pattern is being used.
- Use an asterisk (*) as a wildcard to ignore file extensions or
any trailing characters in the file name. For example, Myapp{###}.log* specifies that any file name that starts
with Myapp, followed by three digits, and followed
by .log, is a match, regardless of what comes
after.
The asterisk must be specified after the curly braces ({ }) and cannot be used at the beginning of a file name.
When you use the asterisk in a file name extension, the asterisk must
be used by itself.
Examples of correct wildcard
(*)usage:
- err{??}.*
- error{$}.*
Examples of incorrect wildcard
(*) usage:
- error.20*
- No curly braces precede the asterisk (*).
- error*.{###}
- The asterisk is not used at the end of the file name.
- error.*
- No curly braces precede the asterisk (*).
- If a specific file extension is defined, then only files with
the same extension are considered.
- Use a number sign to indicate each numeric element of a file name.
- Use a question mark to exclude each element of the naming convention
that does not serve as search criteria in determining the appropriate
file name.
- Use a dollar sign ($) to represent either
any character or no character. For example, if you want to match
on two files named Log and LogA, specify Log{$}. The dollar sign has several
usage restrictions. When you use one or more dollar signs to prefix
a file name as in {$$$$$$}_abc.log, the number
of dollar signs must exactly match the number of characters in that
position in the file name. Also, you cannot specify dollar signs
in multiple locations in a file name pattern, for example, {$$$}b{$$$}.log does not match abc.log. Given these dollar sign restrictions, use regular expression file
name patterns if there are an indeterminate number of characters in
the file names.
- The total number of number signs and question marks that are enclosed
in braces is significant. It must match the portion of file name exactly.
For example, the pattern AA{####} instructs the
File Data Provider to look for files such as AA0001. File names, such as AA001 or AA00001, are not considered.
- The exact file name pattern, the constant, and the numeric parts,
must match the file name exactly. For example, the pattern AA{###} instructs the File Data Provider to check file AA101. File names, such as XAA101, AA222X and AA55555, are
not considered.
- Use the reserved pattern string {TIVOLILOGTIME}to substitute for the hex timestamp and file sequence number in a Tivoli Monitoring agent or server log file. This pattern string is useful
when you do self-monitoring of Tivoli Monitoring components. For example, if you want to monitor the latest monitoring server log in the /opt/IBM/ITM/logsdirectory,
can specify a file name pattern:
/opt/IBM/ITM/logs/Host1_ms_{TIVOLILOGTIME}.log
If Host1_ms_452053c0-01.log, Host1_ms_451f11f4-01.log, Host1_ms_45205946-01.log, and Host1_ms_451f11f4-02.log are present in the /logsdirectory, the Host1_ms_45205946-01.log file is selected for monitoring.
To precisely specify a file name that consists of date
components (year, month, and day), use the capital letters Y, M, and
D. These letters must be specified within braces; otherwise they are
treated as literal characters in the file name.
See the following
examples:
- {YYYYMMDD}.log
- Specifies file names such as 20060930.log or 20061015.log.
- {MMDDYY}.log
- Specifies file names such as 101106.log or 110106.log.
- {DDMMYYYY}.log
- Specifies file names such as 01092006.log or 15082006.log.
- {DDMMMYY}.log
- Specifies file names such as 24Jan07 or 13Sep06.
- {MM-DD-YY}.log
- Specifies file names such as 11-02-06 or 04-29-07. The (-)separator character is ignored in the date field and
does not require a question mark pattern character to skip over it.
- MY{YYDDD}.log
- Specifies file names such as MY06202.log, MY06010.log, or MY04350.log.
Complex cases exist, where a date field is embedded
within a longer file name, and the date patterns in the previous examples
are not sufficient. For complex cases, create patterns that mix number
signs and question marks and still perform numeric comparisons that
select the most current file for monitoring. For example, the pattern ABC{?####?##?##?##?##?##?}XYZ.TXT can be used for file
names such as ABC 2006-04-20 11_22_33 XYZ.TXT. In this example, you are interested in only the #- marked digits and question marks serve as placeholders that ignore
other characters in the file name.
The File Data Provider periodically
checks for new files that match the defined file pattern in the target
path location. When a newer file that matches the pattern is detected,
the File Data Provider automatically switches application monitoring
to the new file. The File Data Provider searches for the best matching
file when: