@Plugin(name="Flume", category="Core", elementType="appender", printObject=true) public final class FlumeAppender extends org.apache.logging.log4j.core.appender.AbstractAppender implements FlumeEventFactory
Modifier and Type | Method and Description |
---|---|
void |
append(org.apache.logging.log4j.core.LogEvent event)
Publish the event.
|
static FlumeAppender |
createAppender(Agent[] agents,
org.apache.logging.log4j.core.config.Property[] properties,
String hosts,
String embedded,
String type,
String dataDir,
String connectionTimeoutMillis,
String requestTimeoutMillis,
String agentRetries,
String maxDelayMillis,
String name,
String ignore,
String excludes,
String includes,
String required,
String mdcPrefix,
String eventPrefix,
String compressBody,
String batchSize,
String lockTimeoutRetries,
FlumeEventFactory factory,
org.apache.logging.log4j.core.Layout<? extends Serializable> 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.
|
boolean |
stop(long timeout,
TimeUnit timeUnit) |
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, requiresLocation, setHandler, toSerializable, toString
addFilter, getFilter, getPropertyArray, hasFilter, isFiltered, removeFilter, start, stop
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
public void append(org.apache.logging.log4j.core.LogEvent event)
append
in interface org.apache.logging.log4j.core.Appender
event
- The LogEvent.public boolean stop(long timeout, TimeUnit timeUnit)
stop
in interface org.apache.logging.log4j.core.LifeCycle2
stop
in class org.apache.logging.log4j.core.filter.AbstractFilterable
public FlumeEvent createEvent(org.apache.logging.log4j.core.LogEvent event, String includes, String excludes, String required, String mdcPrefix, String eventPrefix, boolean compress)
createEvent
in interface FlumeEventFactory
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.@PluginFactory public static FlumeAppender createAppender(@PluginElement(value="Agents") Agent[] agents, @PluginElement(value="Properties") org.apache.logging.log4j.core.config.Property[] properties, @PluginAttribute(value="hosts") String hosts, @PluginAttribute(value="embedded") String embedded, @PluginAttribute(value="type") String type, @PluginAttribute(value="dataDir") String dataDir, @PluginAliases(value="connectTimeout") @PluginAttribute(value="connectTimeoutMillis") String connectionTimeoutMillis, @PluginAliases(value="requestTimeout") @PluginAttribute(value="requestTimeoutMillis") String requestTimeoutMillis, @PluginAttribute(value="agentRetries") String agentRetries, @PluginAliases(value="maxDelay") @PluginAttribute(value="maxDelayMillis") String maxDelayMillis, @PluginAttribute(value="name") String name, @PluginAttribute(value="ignoreExceptions") String ignore, @PluginAttribute(value="mdcExcludes") String excludes, @PluginAttribute(value="mdcIncludes") String includes, @PluginAttribute(value="mdcRequired") String required, @PluginAttribute(value="mdcPrefix") String mdcPrefix, @PluginAttribute(value="eventPrefix") String eventPrefix, @PluginAttribute(value="compress") String compressBody, @PluginAttribute(value="batchSize") String batchSize, @PluginAttribute(value="lockTimeoutRetries") String lockTimeoutRetries, @PluginElement(value="FlumeEventFactory") FlumeEventFactory factory, @PluginElement(value="Layout") org.apache.logging.log4j.core.Layout<? extends Serializable> layout, @PluginElement(value="Filter") org.apache.logging.log4j.core.Filter filter)
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.connectionTimeoutMillis
- The amount of time in milliseconds to wait before a connection times out. Minimum is
1000.requestTimeoutMillis
- 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.maxDelayMillis
- The maximum number of milliseconds to wait for a complete batch.name
- The name of the Appender.ignore
- If "true"
(default) exceptions encountered when appending events are logged; otherwise
they are propagated to the caller.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.lockTimeoutRetries
- Times to retry a lock timeout when writing to Berkeley DB.factory
- The factory to use to create Flume events.layout
- The layout to format the event.filter
- A Filter to filter events.Copyright © 1999-1969 The 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.