The format of the messages received from the eventlog and the file sources can be
customized using templates. You can define separate message format for the eventlog and
the file sources. When creating a template to customize the message format, you can use
macros, all alphanumeric characters, and the following special characters:
<>,():;-+/_.
To create a template, complete the following procedure:
![]() |
Warning |
|---|---|
These macros are available only in the syslog-ng Agent for Windows. To recognize Windows-specific elements of the log message (e.g., eventlog-related macros) on the syslog-ng server, you have to use parsers on the syslog-ng server. The parser must be configured to match the message format set in the syslog-ng Agent. See Section 3.8, “Parsing messages” for details. |
Procedure 5.6.1. Customizing messages using templates
Start the configuration interface of the syslog-ng Agent for Windows application.
Select , and double-click on . Select your logserver, and click .
Type the message format you want to use into the Template
field. Do not forget to add the $ character before
macros. See Section 5.6.5, “Macros available in the syslog-ng Agent” for a complete list of the
available macros.
For example, to send the messages in the DATE HOSTNAME
MESSAGE format, type Date:$DATE Hostname:$HOST
Logmessage:$MESSAGE.
Note that the $MESSAGE macro contains not only the text of the log message, but also additional information received from the message source, such as the name of the eventlog container, or the file, as set in the eventlog-specific and file-specific templates. See Procedure 5.6.2, “Customizing eventlog messages” and Procedure 5.6.2, “Customizing eventlog messages” for details on modifying the eventlog-specific and file-specific templates.
![]() |
Note |
|---|---|
Templates are assigned to a single destination server, so it is possible to use different templates for different servers. However, a server and its failover servers always receive the same message. |
![]() |
Warning |
|---|---|
If you have more than one destination servers configured (separate servers, not in failover mode), and you want to use the same template for every server, you must manually copy the template into the configuration of each server. Template modifications are not applied automatically to every server. |
Click .
To activate the changes, restart the syslog-ng Agent service.
To customize the format of eventlog messages, complete the following procedure. This template is applied by the $MESSAGE macro to format messages received from the eventlog.
Procedure 5.6.2. Customizing eventlog messages
Start the configuration interface of the syslog-ng Agent for Windows application.
Select , right-click on and select .
Type the message format into the Message Template field.
You can use date- and eventlog-related macros (see Section 5.6.5, “Macros available in the syslog-ng Agent” for a list of macros).The message customized here
is included in the server-specific templates using the
MESSAGE macro.
By default, the following is sent about file messages:
${EVENT_USERNAME}: ${EVENT_NAME} ${EVENT_SOURCE}: [${EVENT_TYPE}]
${EVENT_MSG} (EventID ${EVENT_ID}).
Select , then . To activate the changes, restart the syslog-ng Agent service.
To customize the format of file messages, complete the following procedure. This template is applied by the $MESSAGE macro to format messages received from the log files.
Procedure 5.6.3. Customizing file messages
Start the configuration interface of the syslog-ng Agent for Windows application.
Select , right-click on and select .
Type the message format into the Message Template field.
You can use date- and file-related macros (see Section 5.6.5, “Macros available in the syslog-ng Agent”
for a list of macros). The message customized here is included in the
server-specific templates using the MESSAGE macro.
By default, the following is sent about file messages: $FILE_NAME:
$FILE_MESSAGE.
Select , then . To activate the changes, restart the syslog-ng Agent service.
© 2007-2010 BalaBit IT Security
Please send your comments or documentation bugs to: documentation@balabit.com