org.apache.logging.log4j.flume.appender
Class FlumeAppender<T extends Serializable>
java.lang.Object
org.apache.logging.log4j.core.filter.AbstractFilterable
org.apache.logging.log4j.core.appender.AbstractAppender<T>
org.apache.logging.log4j.flume.appender.FlumeAppender<T>
- All Implemented Interfaces:
- org.apache.logging.log4j.core.Appender<T>, org.apache.logging.log4j.core.filter.Filterable, org.apache.logging.log4j.core.LifeCycle, FlumeEventFactory
public final class FlumeAppender<T extends Serializable>
- extends org.apache.logging.log4j.core.appender.AbstractAppender<T>
- implements FlumeEventFactory
An Appender that uses the Avro protocol to route events to Flume.
Fields inherited from class org.apache.logging.log4j.core.appender.AbstractAppender |
LOGGER |
Method Summary |
void |
append(org.apache.logging.log4j.core.LogEvent event)
Publish the event. |
static
|
createAppender(Agent[] agents,
org.apache.logging.log4j.core.config.Property[] properties,
String embedded,
String type,
String dataDir,
String connectionTimeout,
String requestTimeout,
String agentRetries,
String maxDelay,
String name,
String suppress,
String excludes,
String includes,
String required,
String mdcPrefix,
String eventPrefix,
String compressBody,
String batchSize,
FlumeEventFactory factory,
org.apache.logging.log4j.core.Layout<S> layout,
org.apache.logging.log4j.core.Filter filter)
Create a Flume Avro Appender. |
FlumeEvent |
createEvent(org.apache.logging.log4j.core.LogEvent event,
String includes,
String excludes,
String required,
String mdcPrefix,
String eventPrefix,
boolean compress)
Create a Flume event. |
void |
stop()
|
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender |
error, error, error, getHandler, getLayout, getName, isExceptionSuppressed, isStarted, setHandler, start, toString |
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable |
addFilter, getFilter, hasFilter, isFiltered, removeFilter, startFilter, stopFilter |
append
public void append(org.apache.logging.log4j.core.LogEvent event)
- Publish the event.
- Specified by:
append
in interface org.apache.logging.log4j.core.Appender<T extends Serializable>
- Parameters:
event
- The LogEvent.
stop
public void stop()
- Specified by:
stop
in interface org.apache.logging.log4j.core.LifeCycle
- Overrides:
stop
in class org.apache.logging.log4j.core.appender.AbstractAppender<T extends Serializable>
createEvent
public FlumeEvent createEvent(org.apache.logging.log4j.core.LogEvent event,
String includes,
String excludes,
String required,
String mdcPrefix,
String eventPrefix,
boolean compress)
- Create a Flume event.
- Specified by:
createEvent
in interface FlumeEventFactory
- Parameters:
event
- The Log4j LogEvent.includes
- comma separated list of mdc elements to include.excludes
- comma separated list of mdc elements to exclude.required
- comma separated list of mdc elements that must be present with a value.mdcPrefix
- The prefix to add to MDC key names.eventPrefix
- The prefix to add to event fields.compress
- If true the body will be compressed.
- Returns:
- A Flume Event.
createAppender
public static <S extends Serializable> FlumeAppender<S> createAppender(Agent[] agents,
org.apache.logging.log4j.core.config.Property[] properties,
String embedded,
String type,
String dataDir,
String connectionTimeout,
String requestTimeout,
String agentRetries,
String maxDelay,
String name,
String suppress,
String excludes,
String includes,
String required,
String mdcPrefix,
String eventPrefix,
String compressBody,
String batchSize,
FlumeEventFactory factory,
org.apache.logging.log4j.core.Layout<S> layout,
org.apache.logging.log4j.core.Filter filter)
- Create a Flume Avro Appender.
- Parameters:
agents
- An array of Agents.properties
- Properties to pass to the embedded agent.embedded
- true if the embedded agent manager should be used. otherwise the Avro manager will be used.
Note: The embedded attribute is deprecated in favor of specifying the type attribute.type
- Avro (default), Embedded, or Persistent.dataDir
- The directory where the Flume FileChannel should write its data.connectionTimeout
- The amount of time in milliseconds to wait before a connection times out. Minimum is
1000.requestTimeout
- The amount of time in milliseconds to wait before a request times out. Minimum is 1000.agentRetries
- The number of times to retry an agent before failing to the next agent.maxDelay
- The maximum number of seconds to wait for a complete batch.name
- The name of the Appender.suppress
- If true exceptions will be handled in the appender.excludes
- A comma separated list of MDC elements to exclude.includes
- A comma separated list of MDC elements to include.required
- A comma separated list of MDC elements that are required.mdcPrefix
- The prefix to add to MDC key names.eventPrefix
- The prefix to add to event key names.compressBody
- If true the event body will be compressed.batchSize
- Number of events to include in a batch. Defaults to 1.factory
- The factory to use to create Flume events.layout
- The layout to format the event.filter
- A Filter to filter events.
- Returns:
- A Flume Avro Appender.
Copyright © 1999-2013 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.