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 Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.nifi.components.PropertyDescriptorprivate static final Stringprivate EventServerstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate byte[]static final org.apache.nifi.components.PropertyDescriptorprivate SyslogParserprivate static final List<org.apache.nifi.components.PropertyDescriptor> protected static final Stringstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.processor.Relationshipstatic final org.apache.nifi.processor.Relationshipprivate static final Set<org.apache.nifi.processor.Relationship> static final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprotected static final Stringprivate BlockingQueue<ByteArrayMessage> static final org.apache.nifi.components.PropertyDescriptor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) getDefaultAttributes(org.apache.nifi.processor.ProcessContext context) getEventAttributes(SyslogEvent event) private InetAddressgetListenAddress(String networkInterfaceName) intprivate ByteArrayMessagegetMessage(org.apache.nifi.processor.ProcessSession session) Set<org.apache.nifi.processor.Relationship> List<org.apache.nifi.components.PropertyDescriptor> private StringgetTransitUri(org.apache.nifi.flowfile.FlowFile flowFile) voidmigrateProperties(PropertyConfiguration propertyConfiguration) voidonPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue) voidonScheduled(org.apache.nifi.processor.ProcessContext context) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) private SyslogEventparseSyslogEvent(ByteArrayMessage rawSyslogEvent) voidMethods inherited from class org.apache.nifi.processor.AbstractProcessor
onTriggerMethods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getPropertyDescriptor, getPropertyDescriptors, validateMethods inherited from interface org.apache.nifi.processor.Processor
isStateful, migrateRelationships
-
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
-
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
-
RECEIVED_COUNTER
- See Also:
-
SUCCESS_COUNTER
- See Also:
-
DEFAULT_MIME_TYPE
- See Also:
-
eventServer
-
parser
-
syslogEvents
-
messageDemarcatorBytes
private volatile byte[] messageDemarcatorBytes
-
-
Constructor Details
-
ListenSyslog
public ListenSyslog()
-
-
Method Details
-
migrateProperties
-
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
onPropertyModified
public void onPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue) - Specified by:
onPropertyModifiedin interfaceorg.apache.nifi.components.ConfigurableComponent- Overrides:
onPropertyModifiedin classorg.apache.nifi.components.AbstractConfigurableComponent
-
customValidate
protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) - Overrides:
customValidatein classorg.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:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor- Throws:
org.apache.nifi.processor.exception.ProcessException
-
getListenAddress
- Throws:
SocketException
-
parseSyslogEvent
-
getMessage
-
getTransitUri
-
getDefaultAttributes
-
getEventAttributes
-