Class ListenSyslog

java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.AbstractSyslogProcessor
org.apache.nifi.processors.standard.ListenSyslog
All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent, org.apache.nifi.processor.Processor

@SupportsBatching @InputRequirement(INPUT_FORBIDDEN) @Tags({"syslog","listen","udp","tcp","logs"}) @CapabilityDescription("Listens for Syslog messages being sent to a given port over TCP or UDP. Incoming messages are checked against regular expressions for RFC5424 and RFC3164 formatted messages. The format of each message is: (<PRIORITY>)(VERSION )(TIMESTAMP) (HOSTNAME) (BODY) where version is optional. The timestamp can be an RFC5424 timestamp with a format of \"yyyy-MM-dd\'T\'HH:mm:ss.SZ\" or \"yyyy-MM-dd\'T\'HH:mm:ss.S+hh:mm\", or it can be an RFC3164 timestamp with a format of \"MMM d HH:mm:ss\". If an incoming messages matches one of these patterns, the message will be parsed and the individual pieces will be placed in FlowFile attributes, with the original message in the content of the FlowFile. If an incoming message does not match one of these patterns it will not be parsed and the syslog.valid attribute will be set to false with the original message in the content of the FlowFile. Valid messages will be transferred on the success relationship, and invalid messages will be transferred on the invalid relationship.") @WritesAttribute(attribute="syslog.priority",description="The priority of the Syslog message.") @WritesAttribute(attribute="syslog.severity",description="The severity of the Syslog message derived from the priority.") @WritesAttribute(attribute="syslog.facility",description="The facility of the Syslog message derived from the priority.") @WritesAttribute(attribute="syslog.version",description="The optional version from the Syslog message.") @WritesAttribute(attribute="syslog.timestamp",description="The timestamp of the Syslog message.") @WritesAttribute(attribute="syslog.hostname",description="The hostname or IP address of the Syslog message.") @WritesAttribute(attribute="syslog.sender",description="The hostname of the Syslog server that sent the message.") @WritesAttribute(attribute="syslog.body",description="The body of the Syslog message, everything after the hostname.") @WritesAttribute(attribute="syslog.valid",description="An indicator of whether this message matched the expected formats. If this value is false, the other attributes will be empty and only the original message will be available in the content.") @WritesAttribute(attribute="syslog.protocol",description="The protocol over which the Syslog message was received.") @WritesAttribute(attribute="syslog.port",description="The port over which the Syslog message was received.") @WritesAttribute(attribute="mime.type",description="The mime.type of the FlowFile which will be text/plain for Syslog messages.") @SeeAlso({PutSyslog.class,ParseSyslog.class}) public class ListenSyslog extends AbstractSyslogProcessor
  • Field Details

    • MAX_MESSAGE_QUEUE_SIZE

      public static final org.apache.nifi.components.PropertyDescriptor MAX_MESSAGE_QUEUE_SIZE
    • RECV_BUFFER_SIZE

      public static final org.apache.nifi.components.PropertyDescriptor RECV_BUFFER_SIZE
    • MAX_SOCKET_BUFFER_SIZE

      public static final org.apache.nifi.components.PropertyDescriptor MAX_SOCKET_BUFFER_SIZE
    • WORKER_THREADS

      public static final org.apache.nifi.components.PropertyDescriptor WORKER_THREADS
    • MAX_BATCH_SIZE

      public static final org.apache.nifi.components.PropertyDescriptor MAX_BATCH_SIZE
    • MESSAGE_DELIMITER

      public static final org.apache.nifi.components.PropertyDescriptor MESSAGE_DELIMITER
    • PARSE_MESSAGES

      public static final org.apache.nifi.components.PropertyDescriptor PARSE_MESSAGES
    • SSL_CONTEXT_SERVICE

      public static final org.apache.nifi.components.PropertyDescriptor SSL_CONTEXT_SERVICE
    • CLIENT_AUTH

      public static final org.apache.nifi.components.PropertyDescriptor CLIENT_AUTH
    • SOCKET_KEEP_ALIVE

      public static final org.apache.nifi.components.PropertyDescriptor SOCKET_KEEP_ALIVE
    • PROPERTY_DESCRIPTORS

      private static final List<org.apache.nifi.components.PropertyDescriptor> PROPERTY_DESCRIPTORS
    • REL_SUCCESS

      public static final org.apache.nifi.processor.Relationship REL_SUCCESS
    • REL_INVALID

      public static final org.apache.nifi.processor.Relationship REL_INVALID
    • RELATIONSHIPS

      private static final Set<org.apache.nifi.processor.Relationship> RELATIONSHIPS
    • RECEIVED_COUNTER

      protected static final String RECEIVED_COUNTER
      See Also:
    • SUCCESS_COUNTER

      protected static final String SUCCESS_COUNTER
      See Also:
    • DEFAULT_MIME_TYPE

      private static final String DEFAULT_MIME_TYPE
      See Also:
    • eventServer

      private volatile EventServer eventServer
    • parser

      private volatile SyslogParser parser
    • syslogEvents

      private volatile BlockingQueue<ByteArrayMessage> syslogEvents
    • messageDemarcatorBytes

      private volatile byte[] messageDemarcatorBytes
  • Constructor Details

    • ListenSyslog

      public ListenSyslog()
  • Method Details

    • migrateProperties

      public void migrateProperties(PropertyConfiguration propertyConfiguration)
    • getRelationships

      public Set<org.apache.nifi.processor.Relationship> getRelationships()
      Specified by:
      getRelationships in interface org.apache.nifi.processor.Processor
      Overrides:
      getRelationships in class org.apache.nifi.processor.AbstractSessionFactoryProcessor
    • getSupportedPropertyDescriptors

      public List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class org.apache.nifi.components.AbstractConfigurableComponent
    • onPropertyModified

      public void onPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue)
      Specified by:
      onPropertyModified in interface org.apache.nifi.components.ConfigurableComponent
      Overrides:
      onPropertyModified in class org.apache.nifi.components.AbstractConfigurableComponent
    • customValidate

      protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext)
      Overrides:
      customValidate in class org.apache.nifi.components.AbstractConfigurableComponent
    • onScheduled

      @OnScheduled public void onScheduled(org.apache.nifi.processor.ProcessContext context) throws IOException
      Throws:
      IOException
    • getListeningPort

      public int getListeningPort()
    • shutdownEventServer

      @OnStopped public void shutdownEventServer()
    • onTrigger

      public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) throws org.apache.nifi.processor.exception.ProcessException
      Specified by:
      onTrigger in class org.apache.nifi.processor.AbstractProcessor
      Throws:
      org.apache.nifi.processor.exception.ProcessException
    • getListenAddress

      private InetAddress getListenAddress(String networkInterfaceName) throws SocketException
      Throws:
      SocketException
    • parseSyslogEvent

      private SyslogEvent parseSyslogEvent(ByteArrayMessage rawSyslogEvent)
    • getMessage

      private ByteArrayMessage getMessage(org.apache.nifi.processor.ProcessSession session)
    • getTransitUri

      private String getTransitUri(org.apache.nifi.flowfile.FlowFile flowFile)
    • getDefaultAttributes

      private Map<String,String> getDefaultAttributes(org.apache.nifi.processor.ProcessContext context)
    • getEventAttributes

      private Map<String,String> getEventAttributes(SyslogEvent event)