A Rhino management sub task for creating a log socket appender with output formatted for consumption by a syslog daemon.

Ant Parameters
Attribute Type Description Required

appendername

Name of the appender to create. This name must be unique.

Yes.

remotehost

Name or IP address of the remote host to connect to.

Yes.

port

Port on the remote host to connect to.

Yes.

advertise

boolean

Should the appender be advertised

No

appname

String

RFC-5424 APP-NAME to use if using the RFC-5454 record layout

No

enterprisenumber

String

The IANA enterprise number

No

facility

String

The facility to classify messages as. One of "KERN", "USER", "MAIL", "DAEMON", "AUTH", "SYSLOG", "LPR", "NEWS", "UUCP", "CRON", "AUTHPRIV", "FTP", "NTP", "AUDIT", "ALERT", "CLOCK", "LOCAL0", "LOCAL1", "LOCAL2", "LOCAL3", "LOCAL4", "LOCAL5", "LOCAL6", or "LOCAL7".

No

format

String

RFC-5424 or BSD

No

structureddataid

String

The RFC-5424 structured data ID to use if not present in the log message

No

includemdc

boolean

If true, include MDC fields in the RFC-5424 syslog record. Defaults to true.

No

mdcexcludes

String

A comma separated list of MDC fields to exclude. Mutually exclusive with mdcincludes.

No

mdcincludes

String

A comma separated list of MDC fields to include. Mutually exclusive with mdcexcludes.

No

mdcrequired

String

A comma separated list of MDC fields that must be present in the log event for it to be logged. If any of these are not present the event will be rejected with a LoggingException.

No

mdcprefix

String

A string that will be prepended to each MDC key.

No

messageid

String

The default value to be used in the MSGID field of RFC-5424 records.

No

newline

boolean

Write a newline on the end of each syslog record. Defaults to false.

No

No

protocol

String

TCP, UDP or SSL. Defaults to TCP.

No.

buffersize

Integer

The the size of the write buffer. Defults to 256kB

No.

connecttimeoutmillis

Integer

Maximum connection wait time in milliseconds if greater than 0.

No.

reconnectiondelaymillis

Integer

Maximum time to attempt reconnection for before throwing an exception. The default, 0, is to try forever.

No.

immediatefail

boolean

When set to true log events will be rejected immediately if the socket is unavailable instead of queuing.

No.

immediateflush

boolean

Flush to disk after every message. Reduces the risk of data loss on system crash at the cost of performance.

No.

ignoreexceptions

boolean

Log exceptions thrown by this appender then ignore them. If set to false propagate to the caller (used to support selective appenders e.g. FailoverAppender).

No.

failonerror

Flag to control failure behaviour. If 'true', the sub task will throw a BuildException when an error is encountered. If 'false', the sub task will throw a NonFatalBuildException instead of a BuildException under specific circumstances. See below for conditions (if any) which will cause a NonFatalBuildException.

Nested elements

Element

Description

Required

filter

A filter to select events that will be reported by this appender.

No.

layout

The layout to use to format log events. Overrides the format attribute if set. Defaults to SyslogLayout.

No.

component

Additional components such as loggerFields

No

NonFatalBuildException throw conditions
  • This task will throw a NonFatalBuildException if the appender cannot be created, eg. an appender with the same name already exists.

Sample Usage

To create a syslog appender that sends all log messages not filtered by the loggers to Syslog on localhost and all WARN or greater to Syslog on logserver using TLS encryption.

<property name="fileName" value="baz"/>
<slee-management>
    <createsyslogappender appendername="local-syslog" mdcid="mdc" host="localhost" port="9601" facility="SYSLOG" protocol='UDP"/>
    <createsyslogappender appendername="remote-syslog" name="RFC5424" format="RFC5424" host="logserver" port="8514" protocol="TCP" appName="MyApp" includeMDC="true" facility="LOCAL0" enterpriseNumber="18060" newLine="true" messageId="Audit" id="App">
        <component pluginname="SslConfig" properties="protocol=TLS">
            <component pluginname="KeyStore" properties="location=log4j2-keystore.jks, password=KEYSTORE_PASSWORD"/>
            <component pluginname="TrustStore" properties="location=log4j2-truststore.p12, password=TRUSTSTORE_PASSWORD, type=PKCS12"/>
        </component>
        <component pluginname="filters">
            <component pluginname="ThresholdFilter">
                <component pluginname="KeyValuePair" properties="key=rhino, value=WARN"/>
            </component>
        </component>
    </createsyslogappender>
</slee-management>
Previous page Next page
Rhino Version 3.1