This article applies to:
Question:
How do I configure date macros?
Procedure:
One method of log file retrieval, in addition to the use of wildcards, is to specify a date macro. This specification may also be used as a naming convention for reports so that the reports are not overwritten.
Enhanced Date Macro Support for Log File Specification and Report Saving: |
%dd+n%, %dd-n% |
+/- the current day |
%mm+n%, %mm-n% |
+/- the current month |
%yy+n%, %yy-n% %yyyy+n%, %yyyy-n% |
+/- the current year |
%dy% |
day of year (001-366) |
%wy% |
week of year (00-53) |
%dw% |
day of week (0-6) |
%wm% |
week of month (0-5) |
Date Macro Support for Specifying Report Ranges: |
%Date+/-n% |
+/- n number of days from the date specified |
%dd% |
day (01-31) |
%mm% |
month (01-12) |
%mon% * * * |
month (jan-dec) |
%yy%, %yyyy% |
year (2 or 4 digit) |
* * * Note: The %mon% macro is case sensitive. |
Examples:
- Todays date is 05/26/2001 and todays log file is ex20010526.log
ex%yyyy%%mm%%dd%.log
Pulls todays log file - ex20010526.log
ex%yyyy%%mm-1%%dd%.log
Pulls last months log file - ex20010426.log
ex%yyyy%%mm%%dd-5%.log
Pulls the log file from five days ago - ex20010521.log
ex%yyyy-1%%mm%%dd%.log
Pulls last years log file - ex20000526.log
- Todays date is 02/22/2001 and todays log file is log200153.txt
[where 53 is the day of the year]
- Todays date is 03/20/2001
log%yyyy%%dy%.txt
Pulls todays log file where log file name is log200179.txt
[79 is the day of the year]
log%yyyy%%wy%.txt
Pulls this weeks log file where log file name is log200112.txt
[12 is the week of the year]
log%yyyy%%Mon%%wm%.txt
Pulls this weeks log file where log file name is log2001Mar3.txt
[3 is the week of the month]
* * * Notice the case sensitivity of %Mon%
- Mar
log%yyyy%%wy%%dw%.txt
Pulls todays log file where the log file name is log2001122.txt
[12 is the week of the year and 2 is the day of the week]
- To run a report on the last seven days:
Start %Date-8%%mm%
/ %dd%
/%yyyy%
End %Date-1%%mm%
/ %dd%
/%yyyy%
- This article was previously published as:
- NETIQKB986