org.apache.logging.log4j.flume.appender
Class FlumeAvroAppender

java.lang.Object
  extended by org.apache.logging.log4j.core.filter.Filterable
      extended by org.apache.logging.log4j.core.appender.AppenderBase
          extended by org.apache.logging.log4j.flume.appender.FlumeAvroAppender
All Implemented Interfaces:
Appender, Filtering, Lifecycle, FlumeEventFactory

public final class FlumeAvroAppender
extends AppenderBase
implements FlumeEventFactory

An Appender that uses the Avro protocol to route events to Flume.


Field Summary
 
Fields inherited from class org.apache.logging.log4j.core.appender.AppenderBase
LOGGER
 
Method Summary
 void append(LogEvent event)
          Publish the event.
static FlumeAvroAppender createAppender(Agent[] agents, String delay, String agentRetries, String name, String suppress, String excludes, String includes, String required, String mdcPrefix, String eventPrefix, String compressBody, String batchSize, FlumeEventFactory factory, Layout layout, Filter filter)
          Create a Flume Avro Appender.
 FlumeEvent createEvent(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.AppenderBase
close, error, error, error, getHandler, getLayout, getName, isExceptionSuppressed, isStarted, setHandler, start, toString
 
Methods inherited from class org.apache.logging.log4j.core.filter.Filterable
addFilter, getFilter, hasFilter, isFiltered, removeFilter, startFilter, stopFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

append

public void append(LogEvent event)
Publish the event.

Specified by:
append in interface Appender
Parameters:
event - The LogEvent.

stop

public void stop()
Specified by:
stop in interface Lifecycle
Overrides:
stop in class AppenderBase

createEvent

public FlumeEvent createEvent(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 FlumeAvroAppender createAppender(Agent[] agents,
                                               String delay,
                                               String agentRetries,
                                               String name,
                                               String suppress,
                                               String excludes,
                                               String includes,
                                               String required,
                                               String mdcPrefix,
                                               String eventPrefix,
                                               String compressBody,
                                               String batchSize,
                                               FlumeEventFactory factory,
                                               Layout layout,
                                               Filter filter)
Create a Flume Avro Appender.

Parameters:
agents - An array of Agents.
delay - The amount of time in milliseconds to wait between retries.
agentRetries - The number of times to retry an agent before failing to the next agent.
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-2012 Apache Software Foundation. All Rights Reserved.