@SupportsBatching @InputRequirement(value=INPUT_FORBIDDEN) @Tags(value={"syslog","listen","udp","tcp","logs"}) @CapabilityDescription(value="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(value={PutSyslog.class,ParseSyslog.class}) public class ListenSyslog extends AbstractSyslogProcessor
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ListenSyslog.RawSyslogEvent<C extends SelectableChannel>
Wrapper class to pass around the raw message and the host/ip that sent it
|
private static class |
ListenSyslog.RawSyslogEventFactory
EventFactory implementation for RawSyslogEvent.
|
Modifier and Type | Field and Description |
---|---|
private BlockingQueue<ByteBuffer> |
bufferPool |
private ChannelDispatcher |
channelDispatcher |
static PropertyDescriptor |
CLIENT_AUTH |
private List<PropertyDescriptor> |
descriptors |
private BlockingQueue<ListenSyslog.RawSyslogEvent> |
errorEvents |
static PropertyDescriptor |
MAX_BATCH_SIZE |
static PropertyDescriptor |
MAX_CONNECTIONS |
static PropertyDescriptor |
MAX_MESSAGE_QUEUE_SIZE |
static PropertyDescriptor |
MAX_SOCKET_BUFFER_SIZE |
static PropertyDescriptor |
MESSAGE_DELIMITER |
private byte[] |
messageDemarcatorBytes |
static PropertyDescriptor |
PARSE_MESSAGES |
private SyslogParser |
parser |
static PropertyDescriptor |
RECV_BUFFER_SIZE |
static Relationship |
REL_INVALID |
static Relationship |
REL_SUCCESS |
private Set<Relationship> |
relationships |
static PropertyDescriptor |
SSL_CONTEXT_SERVICE |
private BlockingQueue<ListenSyslog.RawSyslogEvent> |
syslogEvents |
Constructor and Description |
---|
ListenSyslog() |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, validate
public static final PropertyDescriptor MAX_MESSAGE_QUEUE_SIZE
public static final PropertyDescriptor RECV_BUFFER_SIZE
public static final PropertyDescriptor MAX_SOCKET_BUFFER_SIZE
public static final PropertyDescriptor MAX_CONNECTIONS
public static final PropertyDescriptor MAX_BATCH_SIZE
public static final PropertyDescriptor MESSAGE_DELIMITER
public static final PropertyDescriptor PARSE_MESSAGES
public static final PropertyDescriptor SSL_CONTEXT_SERVICE
public static final PropertyDescriptor CLIENT_AUTH
public static final Relationship REL_SUCCESS
public static final Relationship REL_INVALID
private Set<Relationship> relationships
private List<PropertyDescriptor> descriptors
private volatile ChannelDispatcher channelDispatcher
private volatile SyslogParser parser
private volatile BlockingQueue<ByteBuffer> bufferPool
private volatile BlockingQueue<ListenSyslog.RawSyslogEvent> syslogEvents
private final BlockingQueue<ListenSyslog.RawSyslogEvent> errorEvents
private volatile byte[] messageDemarcatorBytes
protected void init(ProcessorInitializationContext context)
init
in class AbstractSessionFactoryProcessor
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
public List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
public void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue)
onPropertyModified
in interface ConfigurableComponent
onPropertyModified
in class AbstractConfigurableComponent
protected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate
in class AbstractConfigurableComponent
@OnScheduled public void onScheduled(ProcessContext context) throws IOException
IOException
protected SyslogParser getParser()
protected ChannelDispatcher createChannelReader(ProcessContext context, String protocol, BlockingQueue<ByteBuffer> bufferPool, BlockingQueue<ListenSyslog.RawSyslogEvent> events, int maxConnections, SSLContextService sslContextService, Charset charset) throws IOException
IOException
protected int getPort()
@OnUnscheduled public void onUnscheduled()
protected ListenSyslog.RawSyslogEvent getMessage(boolean longPoll, boolean pollErrorQueue, ProcessSession session)
protected int getErrorQueueSize()
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger
in class AbstractProcessor
ProcessException
Copyright © 2020 Apache NiFi Project. All rights reserved.