org.rhq.plugins.platform
Class SyslogProcessor
java.lang.Object
org.rhq.plugins.platform.SyslogProcessor
- Direct Known Subclasses:
- SyslogFileEventLogDelegate, SyslogListenerEventLogDelegate
public class SyslogProcessor
- extends Object
Processes syslog messages and prepares them as events.
Subclasses need to extend this in order to get the actual syslog messages from some source.
- Author:
- Greg Hinkle, John Mazzitelli
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EVENT_LOG_TYPE
protected static final String EVENT_LOG_TYPE
- See Also:
- Constant Field Values
SyslogProcessor
public SyslogProcessor(ResourceContext resourceContext,
org.rhq.core.domain.configuration.PropertyMap logProperties,
String sourceLocation)
getSourceLocation
protected String getSourceLocation()
getEventContext
protected EventContext getEventContext()
getMinimumEventSeverity
protected org.rhq.core.domain.event.EventSeverity getMinimumEventSeverity()
getIncludesPattern
protected Pattern getIncludesPattern()
getParserRegex
protected Pattern getParserRegex()
convertLine
protected org.rhq.core.domain.event.Event convertLine(String syslogMessage)
- Converts the givem syslog message to an event.
If the parser regular expression was specified, it will be used to parse the message. If it was not
specified, this method will attempt to handle this format:
"%timegenerated:::date-rfc3339%,%syslogpriority-text%,%syslogfacility-text%:%msg%\n"
If that fails, the entire line will be used as the message detail, with the timestamp being the current
time and the severity being INFO.
- Parameters:
syslogMessage - the actual syslog message
- Returns:
- the event, or
null if the event didn't match our regex, wasn't of the minimum severity
or couldn't be parsed successfully
convertLineParserRegEx
protected org.rhq.core.domain.event.Event convertLineParserRegEx(String syslogMessage)
convertLineDefaultFormat
protected org.rhq.core.domain.event.Event convertLineDefaultFormat(String syslogMessage)
convertAnyLine
protected org.rhq.core.domain.event.Event convertAnyLine(String syslogMessage)
getTimestamp
protected long getTimestamp(String dateTimeString)
- Given a date/time stamp, this will parse it using the configured date/time format.
If no format is specified or an error occurs, the current time will be returned.
However, if no format is specified but the date string is specified in RFC3339 format,
this method will parse it as such.
RFC3339 format is like "YYYY-MM-DDTHH:mm:ss-00:00" where 'T' separates the date and time.
- Parameters:
dateTimeString - the date-time string to parse and return its epoch millis representation
- Returns:
- the epoch millis that corresponds to the given time or current time otherwise
getSeverity
protected org.rhq.core.domain.event.EventSeverity getSeverity(String severityString)
- Given a severity string, returns the severity enum.
- Parameters:
severityString -
- Returns:
- enum
parseRFC3339Date
protected Date parseRFC3339Date(String rfc3339String)
throws Exception
- Throws:
Exception
Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.