Chapter 342. Syslog DataFormat Available as of Camel version 2.6 The syslog dataformat is used for working with RFC3164 and RFC5424 messages. This component supports the following: UDP consumption of syslog messages Agnostic data format using either plain String objects or SyslogMessage model objects. Type Converter from/to SyslogMessage and String Integration with the camel-mina component. Integration with the camel-netty component. Camel 2.14: Encoder and decoder for the camel-netty component. Camel 2.14: Support for RFC5424 also. Maven users will need to add the following dependency to their pom.xml for this component: <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-syslog</artifactId> <version>x.x.x</version> <!-- use the same version as your Camel core version --> </dependency> 342.1. RFC3164 Syslog protocol Syslog uses the user datagram protocol (UDP) 1 as its underlying transport layer mechanism. The UDP port that has been assigned to syslog is 514. To expose a Syslog listener service we reuse the existing camel-mina component or camel-netty where we just use the Rfc3164SyslogDataFormat to marshal and unmarshal messages. Notice that from Camel 2.14 onwards the syslog dataformat is renamed to SyslogDataFormat . 342.2. Options The Syslog dataformat supports 1 options, which are listed below. Name Default Java Type Description contentTypeHeader false Boolean Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. 342.3. Spring Boot Auto-Configuration The component supports 2 options, which are listed below. Name Description Default Type camel.dataformat.syslog.content-type-header Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. false Boolean camel.dataformat.syslog.enabled Enable syslog dataformat true Boolean ND 342.4. RFC5424 Syslog protocol Available as of Camel 2.14 To expose a Syslog listener service we reuse the existing camel-mina component or camel-netty where we just use the SyslogDataFormat to marshal and unmarshal messages 342.4.1. Exposing a Syslog listener In our Spring XML file, we configure an endpoint to listen for udp messages on port 10514, note that in netty we disable the defaultCodec, this will allow a fallback to a NettyTypeConverter and delivers the message as an InputStream: <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring"> <dataFormats> <syslog id="mySyslog"/> </dataFormats> <route> <from uri="netty:udp://localhost:10514?sync=false&amp;allowDefaultCodec=false"/> <unmarshal ref="mySyslog"/> <to uri="mock:stop1"/> </route> </camelContext> The same route using camel-mina <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring"> <dataFormats> <syslog id="mySyslog"/> </dataFormats> <route> <from uri="mina:udp://localhost:10514"/> <unmarshal ref="mySyslog"/> <to uri="mock:stop1"/> </route> </camelContext> 342.4.2. Sending syslog messages to a remote destination <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring"> <dataFormats> <syslog id="mySyslog"/> </dataFormats> <route> <from uri="direct:syslogMessages"/> <marshal ref="mySyslog"/> <to uri="mina:udp://remotehost:10514"/> </route> </camelContext> 342.5. See Also Configuring Camel Component Endpoint Getting Started

Commands:
<dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-syslog</artifactId> <version>x.x.x</version> <!-- use the same version as your Camel core version --> </dependency>
<camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring"> <dataFormats> <syslog id="mySyslog"/> </dataFormats> <route> <from uri="netty:udp://localhost:10514?sync=false&amp;allowDefaultCodec=false"/> <unmarshal ref="mySyslog"/> <to uri="mock:stop1"/> </route> </camelContext>
<camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring"> <dataFormats> <syslog id="mySyslog"/> </dataFormats> <route> <from uri="mina:udp://localhost:10514"/> <unmarshal ref="mySyslog"/> <to uri="mock:stop1"/> </route> </camelContext>
<camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring"> <dataFormats> <syslog id="mySyslog"/> </dataFormats> <route> <from uri="direct:syslogMessages"/> <marshal ref="mySyslog"/> <to uri="mina:udp://remotehost:10514"/> </route> </camelContext>