The SYSLOG output format generates messages formatted according
to the Syslog specifications described in RFC 3164.
Syslog messages consist of six parts, and the SYSLOG output format
provides parameters that allow users to assign constants or output
record fields to the different parts of a message.
A sample Syslog message is formatted as follows:
<14>Nov 11 16:05:33 MYSERVER-M LogParser:The service was started.
This message consists of the following parts:
The PRI part is bound with angle brackets and contains a decimal Priority value, which in turn is built as follows:
The HEADER part consists of the following two elements:
The MSG part consists of the following two elements:
Numerical Value | Facility Name |
---|---|
0 | kern |
1 | user |
2 | |
3 | daemon |
4 | auth |
5 | mark |
6 | lpr |
7 | news |
8 | uucp |
9 | cron |
10 | auth2 |
11 | ftp |
12 | ntp |
13 | logaudit |
14 | logalert |
15 | clock |
16 | local0 |
17 | local1 |
18 | local2 |
19 | local3 |
20 | local4 |
21 | local5 |
22 | local6 |
23 | local7 |
The facility parameter of
the SYSLOG output format allows users to control the value of the
facility field in the output messages.
This parameter can be set to any of the following values:
The following example query returns event messages from the System event log together with a "MyFacility" field that maps each event source to a Syslog facility name:
SELECT CASE SourceName WHEN 'EventLog' THEN 'mark' WHEN 'Service Control Manager' THEN 'daemon' WHEN 'Print' THEN 'lpr' WHEN 'Kerberos' THEN 'auth' WHEN 'NETLOGON' THEN 'logaudit' WHEN 'Application Popup' THEN 'local7' ELSE 'local0' END AS MyFacility, Message INTO SYSLOG FROM SystemThis query can be executed with the following command, which specifies that the facility value of each output message is to be retrieved from the "MyFacility" output record field:
LogParser file:MyQuery.sql -o:SYSLOG -conf:Myconfig.conf -facility:$MyFacilityThe Syslog messages generated by this command will look like the following examples:
<134>Nov 13 18:17:25 MYSERVER-M LogParser:The service was started. <46>Nov 13 18:17:46 MYSERVER-M LogParser:The Event log service was started. <30>Nov 13 18:17:46 MYSERVER-M LogParser:The Telephony service entered the running state. <46>Nov 13 18:17:46 MYSERVER-M LogParser:The Event log service was stopped. <134>Nov 13 18:17:46 MYSERVER-M LogParser:The service was started. <46>Nov 13 18:17:46 MYSERVER-M LogParser:The Event log service was started. <30>Nov 13 18:17:46 MYSERVER-M LogParser:The Telephony service entered the running state. <46>Nov 13 18:17:46 MYSERVER-M LogParser:The Event log service was stopped. <134>Nov 13 18:17:46 MYSERVER-M LogParser:The service was started. <46>Nov 13 18:17:46 MYSERVER-M LogParser:The Event log service was started. <30>Nov 13 18:17:46 MYSERVER-M LogParser:The Telephony service entered the running state.The upper 7 bits of the priority field of each of these messages contain the facility value provided by the "MyFacility" output record field.
Numerical Value | Severity Name |
---|---|
0 | emerg |
1 | alert |
2 | crit |
3 | err |
4 | warning |
5 | notice |
6 | info |
7 | debug |
The severity parameter of
the SYSLOG output format allows users to control the value of the
severity field in the output messages.
This parameter can be set to any of the following values:
The following example query returns event messages from the System event log together with a "MySeverity" field that maps each event type to a Syslog severity name:
SELECT CASE EventTypeName WHEN 'Error event' THEN 'err' WHEN 'Warning event' THEN 'warning' WHEN 'Information event' THEN 'info' ELSE 'info' END AS MySeverity, Message INTO SYSLOG FROM SystemThis query can be executed with the following command, which specifies that the severity value of each output message is to be retrieved from the "MySeverity" output record field:
LogParser file:MyQuery.sql -o:SYSLOG -conf:Myconfig.conf -severity:$MySeverityThe Syslog messages generated by this command will look like the following examples:
<14>Nov 13 21:42:15 MYSERVER-M LogParser:The Event log service was started. <11>Nov 13 21:42:15 MYSERVER-M LogParser:The Computer Browser service terminated with service-specific error 2550 (0x9F6). <14>Nov 13 21:42:15 MYSERVER-M LogParser:The Terminal Services service was successfully sent a start control. <12>Nov 13 21:42:15 MYSERVER-M LogParser:A request to suspend power was denied by winlogon.exe. <14>Nov 13 21:42:15 MYSERVER-M LogParser:The Event log service was stopped.The lower 3 bits of the priority field of each of these messages contain the severity value provided by the "MySeverity" output record field.
Nov 11 16:05:33
If the first field in the query output records is of the
TIMESTAMP data type, the SYSLOG
output format will use the field values to populate the timestamp
field in the output messages.
On the other hand, if the first field is not of the TIMESTAMP data
type, the SYSLOG output format will use the current local time.
The following example query returns event messages from the System event log together with the date and time at which the events have been generated:
SELECT TimeGenerated, Message INTO SYSLOG FROM System WHERE SourceName = 'EventLog'The Syslog messages generated by this query will look like the following examples:
<14>Apr 18 18:48:04 MYSERVER-M LogParser:The Event log service was started. <14>Apr 18 18:51:37 MYSERVER-M LogParser:The Event log service was stopped. <14>Apr 18 19:20:07 MYSERVER-M LogParser:Microsoft (R) Windows (R) 5.01. 2600 Service Pack 1 Uniprocessor Free. <14>Apr 18 19:20:07 MYSERVER-M LogParser:The Event log service was started. <14>Apr 18 19:33:17 MYSERVER-M LogParser:The Event log service was stopped. <14>Apr 19 07:01:41 MYSERVER-M LogParser:Microsoft (R) Windows (R) 5.01. 2600 Service Pack 1 Uniprocessor Free. <14>Apr 19 07:01:41 MYSERVER-M LogParser:The Event log service was started. <14>Apr 19 07:29:19 MYSERVER-M LogParser:The Event log service was stopped.
The hostName parameter of
the SYSLOG output format allows users to control the value of the
hostname field in the output messages.
This parameter can be set to any of the following values:
The following example query returns event messages from the System event log of different computers, together with the computer name on which the event originated:
SELECT Message, ComputerName INTO SYSLOG FROM \\MYSERVER01\System,\\MYSERVER02\System,\\MYSERVER03\SystemThis query can be executed with the following command, which specifies that the hostname field of each output message is to be retrieved from the second output record field:
LogParser file:MyQuery.sql -o:SYSLOG -conf:Myconfig.conf -hostName:$2The Syslog messages generated by this command will look like the following examples:
<14>Nov 13 22:07:11 MYSERVER03 LogParser:Microsoft (R) Windows (R) 5.01. 2600 Service Pack 1 Uniprocessor Free. <14>Nov 13 22:07:11 MYSERVER03 LogParser:The Event log service was started. <14>Nov 13 22:07:11 MYSERVER01 LogParser:The Terminal Services service was successfully sent a start control. <14>Nov 13 22:07:11 MYSERVER02 LogParser:The Network Connections service was successfully sent a start control. <14>Nov 13 22:07:11 MYSERVER01 LogParser:The Terminal Services service entered the running state. <14>Nov 13 22:07:11 MYSERVER02 LogParser:The Network Connections service entered the running state. <14>Nov 13 22:07:11 MYSERVER02 LogParser:The SSDP Discovery Service service was successfully sent a start control. <14>Nov 13 22:07:11 MYSERVER03 LogParser:The SSDP Discovery Service service was successfully sent a start control.
The processName parameter
of the SYSLOG output format allows users to control the value of
the tag field in the output messages.
This parameter can be set to any of the following values:
The following example query returns information from the System event log:
SELECT SourceName, EventTypeName, EventCategoryName, Message INTO SYSLOG FROM SystemThe Syslog messages generated by this query will look like the following examples:
<14>Nov 13 22:27:17 MYSERVER-M LogParser:EventLog Information event None Microsoft (R) Windows (R) 5.01. 2600 Service Pack 1 Uniprocessor Free. <14>Nov 13 22:27:17 MYSERVER-M LogParser:EventLog Information event None The Event log service was started. <14>Nov 13 22:27:17 MYSERVER-M LogParser:Service Control Manager Error event None The Computer Browser service terminated with service-specific error 2550 (0x9F6). <14>Nov 13 22:27:17 MYSERVER-M LogParser:EventLog Information event None The Event log service was stopped. <14>Nov 13 22:27:17 MYSERVER-M LogParser:Ati HotKey Poller Information event None The service was started. <14>Nov 13 22:27:17 MYSERVER-M LogParser:EventLog Information event None Microsoft (R) Windows (R) 5.01. 2600 Service Pack 1 Uniprocessor Free. <14>Nov 13 22:27:17 MYSERVER-M LogParser:EventLog Information event None The Event log service was started. <14>Nov 13 22:27:17 MYSERVER-M LogParser:EventLog Information event None The Event log service was stopped.
© 2004 Microsoft Corporation. All rights reserved.