Flume 2.0.0 User Guide

Introduction

Overview

Apache Flume is a distributed, reliable, and available system for efficiently collecting, aggregating and moving large amounts of log data from many different sources to a centralized data store.

The use of Apache Flume is not only restricted to log data aggregation. Since data sources are customizable, Flume can be used to transport massive quantities of event data including but not limited to network traffic data, social-media-generated data, email messages and pretty much any data source possible.

Apache Flume is a project managed by the Logging Service PMC at the Apache Software Foundation.

System Requirements

  1. Java Runtime Environment - Java 17 or later

  2. Memory - Sufficient memory for configurations used by sources, channels or sinks

  3. Disk Space - Sufficient disk space for configurations used by channels or sinks

  4. Directory Permissions - Read/Write permissions for directories used by agent

Architecture

Data flow model

A Flume event is defined as a unit of data flow having a byte payload and an optional set of string attributes. A Flume agent is a (JVM) process that hosts the components through which events flow from an external source to the next destination (hop).

Agent component diagram

A Flume source consumes events delivered to it by an external source like a web server. The external source sends events to Flume in a format that is recognized by the target Flume source. For example, an Avro Flume source can be used to receive Avro events from Avro clients or other Flume agents in the flow that send events from an Avro sink. A similar flow can be defined using a Thrift Flume Source to receive events from a Thrift Sink or a Flume Thrift Rpc Client or Thrift clients written in any language generated from the Flume thrift protocol.When a Flume source receives an event, it stores it into one or more channels. The channel is a passive store that keeps the event until it’s consumed by a Flume sink. The file channel is one example — it is backed by the local filesystem. The sink removes the event from the channel and puts it into an external repository like MongoDb (via Flume MongoDb sink) or forwards it to the Flume source of the next Flume agent (next hop) in the flow. The source and sink within the given agent run asynchronously with the events staged in the channel.

Complex flows

Flume allows a user to build multi-hop flows where events travel through multiple agents before reaching the final destination. It also allows fan-in and fan-out flows, contextual routing and backup routes (fail-over) for failed hops.

Reliability

The events are staged in a channel on each agent. The events are then delivered to the next agent or terminal repository (like MongoDb) in the flow. The events are removed from a channel only after they are stored in the channel of next agent or in the terminal repository. This is a how the single-hop message delivery semantics in Flume provide end-to-end reliability of the flow.

Flume uses a transactional approach to guarantee the reliable delivery of the events. The sources and sinks encapsulate in a transaction the storage/retrieval, respectively, of the events placed in or provided by a transaction provided by the channel. This ensures that the set of events are reliably passed from point to point in the flow. In the case of a multi-hop flow, the sink from the previous hop and the source from the next hop both have their transactions running to ensure that the data is safely stored in the channel of the next hop.

Recoverability

The events are staged in the channel, which manages recovery from failure. Flume supports a durable file channel which is backed by the local file system. There’s also a memory channel which simply stores the events in an in-memory queue, which is faster but any events still left in the memory channel when an agent process dies can’t be recovered.

Flume’s KafkaChannel uses Apache Kafka to stage events. Using a replicated Kafka topic as a channel helps avoiding event loss in case of a disk failure.

Standard Setup

This section documents how to configure and wire Flume components using Flume’s long-standing configuration techniques using properties files. YAML and JSON configuration files are also supported in version 2.x. See the following section for creating a Flume application using Spring Boot.

Setting up an agent

Flume agent configuration is stored in one or more configuration files that follow the Java properties file format, the YAML 1.2, or standard JSON. Configurations for one or more agents can be specified in these configuration files. The configuration includes properties of each source, sink and channel in an agent and how they are wired together to form data flows.

Configuring individual components

Each component (source, sink or channel) in the flow has a name, type, and set of properties that are specific to the type and instantiation. For example, an Avro source needs a hostname (or IP address) and a port number to receive data from. A memory channel can have max queue size ("capacity"), and a MongoDb sink needs to know the connection URI, database name, collection name, etc. All such attributes of a component needs to be set in the configuration file of the hosting Flume agent.

Wiring the pieces together

The agent needs to know what individual components to load and how they are connected in order to constitute the flow. This is done by listing the names of each of the sources, sinks and channels in the agent, and then specifying the connecting channel for each sink and source. For example, an agent flows events from an Avro source called avroWeb to a MongoDb sink mongodb-cluster1 via a file channel called file-channel. The configuration file will contain names of these components and file-channel as a shared channel for both avroWeb source and hdfs-cluster1 sink.

Starting an agent

In Flume 2.x users control the building of agents, however it is expected that agents will follow the pattern shown in Flume Samples and the repack-maven-plugin will be used to package the agent and its dependencies into a jar. The Maven pom.xml should include the repack-maven-plugin configured as:

  <properties>
    <!-- Causes the repacked jar to be named ${project.build.finalName}.jar and renames the
         original jar to ${project.build.finalName}.jar.original.
         Must be set as a property: an empty <repackClassifier/> element in the plugin
         configuration is treated as unset. -->
    <repack.classifier />
  </properties>
  <build>
    <plugins>
      <plugin>
        <groupId>org.basepom.maven</groupId>
        <artifactId>repack-maven-plugin</artifactId>
        <version>1.0.2</version>
        <configuration>
          <mainClass>org.apache.flume.node.Application</mainClass>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>repack</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

The agent would be started fro mthe command line using something like:

$ java -n $agent_name -u classpath:///conf/flume-conf.properties -jar flume-custom-1.0.0.jar.

which will start a custom agent.

A simple example

Here, we give an example configuration file, describing a single-node Flume deployment. This configuration lets a user generate events and subsequently logs them to the console.

  • Properties

  • YAML

  • JSON

# example.conf: A single-node Flume configuration

# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444

# Describe the sink
a1.sinks.k1.type = logger

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
# example.conf: A single-node Flume configuration
a1:
  sources:
    r1:
      # Describe/configure the source
      type: netcat
      bind: localhost
      port: 44444
      # Bind the source and sink to the channel
      channels: c1
  sinks:
    k1:
      # Describe the sink
      type: logger
      channel: c1
  channels:
    c1:
      # Use a channel which buffers events in memory
      type: memory
      capacity: 1000
      transactionCapacity: 100
"a1": {
  "sources": {
    "r1": {
      "type": "netcat",
      "bind": "localhost",
      "port": 44444,
      "channels": "c1"
    }
  },
  "sinks": {
    "k1": {
      "type": "logger",
      "channel": "c1"
    }
  },
  "channels": {
    "c1": {
      "type": "memory",
      "capacity": 1000,
      "transactionCapacity": 100
    }
  }
}

This configuration defines a single agent named a1. a1 has a source that listens for data on port 44444, a channel that buffers event data in memory, and a sink that logs event data to the console. The configuration file names the various components, then describes their types and configuration parameters. A given configuration file might define several named agents; when a given Flume process is launched a flag is passed telling it which named agent to manifest.

Note that in both the YAML and JSON configuration the equivalent of

a1.sources = r1
a1.sinks = k1
a1.channels = c1

is not present. For one, it isn’t a legal syntax in either once of them since they all have child properties. Second, it can easily be derived what sources, sinks, and channels appear in the configuration.

Given this configuration file and presuming a flume is created that contains those compoments we can start Flume as follows:

$ java --conf conf --conf-file example.conf --name a1 -jar flume-logger-1.0.0.jar

From a separate terminal, we can then telnet port 44444 and send Flume an event:

$ telnet localhost 44444
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
Hello world! <ENTER>
OK

The original Flume terminal will output the event in a log message.

12/06/19 15:32:19 INFO source.NetcatSource: Source starting
12/06/19 15:32:19 INFO source.NetcatSource: Created serverSocket:sun.nio.ch.ServerSocketChannelImpl[/127.0.0.1:44444]
12/06/19 15:32:34 INFO sink.LoggerSink: Event: { headers:{} body: 48 65 6C 6C 6F 20 77 6F 72 6C 64 21 0D          Hello world!. }

Congratulations - you’ve successfully configured and deployed a Flume agent! Subsequent sections cover agent configuration in much more detail.

Configuration from URIs

Flume supports being configured using URIs instead of just from local files. Direct support for HTTP(S), file, and classpath URIs is included. The HTTP support includes support for authentication using basic authorization but other authorization mechanisms may be supported by specifying the fully qualified name of the class that implements the AuthorizationProvider interface using the --auth-provider option. HTTP also supports reloading of configuration files using polling if the target server properly responds to the If-Modified-Since header.

To specify credentials for HTTP authentication add:

--conf-user userid --conf-password password

to the startup command.

Multiple Configuration Files

Flume supports being configured from multiple configuration files instead of just one. This more easily allows values to be overridden or added based on specific environments. Each file should be configured using its own --conf-file or --conf-uri option. However, all files should either be provided with --conf-file or with --conf-uri. If --conf-file and --conf-uri appear together as options all --conf-uri configurations will be processed before any of the --conf-file configurations are merged.

For example, a configuration of:

$ java --conf conf --conf-file example.conf --conf-uri http://localhost:80/flume.conf --conf-uri http://localhost:80/override.conf --name a1 -jar myflume-1.0.0.jar

will cause flume.conf to be read first, override.conf to be merged with it and finally example.conf would be merged last. If it is desirec to have example.conf be the base configuration it should be specified using the --conf-uri option either as:

--conf-uri classpath://example.conf
or
--conf-uri file:///example.conf

depending on how it should be accessed.

Using environment variables, system properies, or other properties configuration files

Flume has the ability to substitute environment variables in the configuration. For example:

a1.sources = r1
a1.sources.r1.type = netcat
a1.sources.r1.bind = 0.0.0.0
a1.sources.r1.port = ${env:NC_PORT}
a1.sources.r1.channels = c1

NB: it currently works for values only, not for keys. (Ie. only on the "right side" of the = mark of the config lines.)

Flume resolves configuration values using Apache Commons Text’s StringSubstitutor class using the default set of Lookups along with a lookup that uses the configuration files as a source for replacement values.

For example

$ NC_PORT=44444 java --conf conf --conf-file example.conf --name a1 -jar myflume-1.0.0.jar

Note the above is just an example, environment variables can be configured in other ways, including being set in conf/flume-env.sh.

As noted, system properties are also supported, so the configuration:

a1.sources = r1
a1.sources.r1.type = netcat
a1.sources.r1.bind = 0.0.0.0
a1.sources.r1.port = ${sys:NC_PORT}
a1.sources.r1.channels = c1

could be used and the startup command could be:

$ java--conf conf --conf-file example.conf --name a1 -DNC_PORT=44444 -jar myflume-1.0.0.jar

Furthermore, because multiple configuration files are allowed the first file could contain:

a1.sources = r1
a1.sources.r1.type = netcat
a1.sources.r1.bind = 0.0.0.0
a1.sources.r1.port = ${NC_PORT}
a1.sources.r1.channels = c1

and the override file could contain:

NC_PORT = 44444

In this case the startup command could be:

$ java --conf conf --conf-file example.conf --conf-file override.conf --name a1 -jar myflume-1.0.0.jar

Note that the method for specifying environment variables as was done in prior versions will stil work but has been deprecated in favor of using ${env:varName}.

Because YAML and JSON configurations are converted to properties before merging and property resolution the same substitutions will apply to them.

Using a command options file

Instead of specifying all the command options on the command line command options may be placed in either /etc/flume/flume.opts or flume.opts on the classpath. An example might be:

conf-file = example.conf
conf-file = override.conf
name = a1

Logging raw data

Logging the raw stream of data flowing through the ingest pipeline is not desired behavior in many production environments because this may result in leaking sensitive data or security related configurations, such as secret keys, to Flume log files. By default, Flume will not log such information. On the other hand, if the data pipeline is broken, Flume will attempt to provide clues for debugging the problem.

One way to debug problems with event pipelines is to set up an additional Memory Channel connected to a Logger Sink, which will output all event data to the Flume logs. In some situations, however, this approach is insufficient.

In order to enable logging of event and configuration-related data, some Java system properties must be set in addition to log4j properties.

To enable configuration-related logging, set the Java system property -Dorg.apache.flume.log.printconfig=true. This can either be passed on the command line or by setting this in the JAVA_OPTS variable in flume-env.sh.

To enable data logging, set the Java system property -Dorg.apache.flume.log.rawdata=true in the same way described above. For most components, the log4j logging level must also be set to DEBUG or TRACE to make event-specific logging appear in the Flume logs.

Here is an example of enabling both configuration logging and raw data logging:

$ java --conf conf --conf-file example.conf --name a1 -Dorg.apache.flume.log.printconfig=true -Dorg.apache.flume.log.rawdata=true -jar myflume-1.0.0.jar

Note: The above section does NOT apply when configuring via Spring Boot.

Data ingestion

Flume supports a number of mechanisms to ingest data from external sources.

RPC

An Avro client included in the Flume RPC distribution can send a given file to Flume Avro source using avro RPC mechanism:

Executing commands

There’s an exec source that executes a given command and consumes the output. A single 'line' of output ie. text followed by carriage return ('\r') or line feed ('\n') or both together.

Network streams

Flume supports the following mechanisms to read data from popular log stream types, such as:

  1. Avro

  2. Thrift

  3. Syslog

  4. Netcat

Setting multi-agent flow

Two agents communicating over Avro RPC

In order to flow the data across multiple agents or hops, the sink of the previous agent and source of the current hop need to be avro type with the sink pointing to the hostname (or IP address) and port of the source.

Consolidation

A very common scenario in log collection is a large number of log producing clients sending audit log data to a few consumer agents that are attached to the storage subsystem. For example, logs collected from hundreds of web servers sent to a cluster of agents that write to MongoDb.

A fan-in flow using Avro RPC to consolidate events in one place

This can be achieved in Flume by configuring a number of first tier agents with an avro sink, all pointing to an avro source of single agent (Again you could use the thrift sources/sinks/clients in such a scenario). This source on the second tier agent consolidates the received events into a single channel which is consumed by a sink to its final destination.

Multiplexing the flow

Flume supports multiplexing the event flow to one or more destinations. This is achieved by defining a flow multiplexer that can replicate or selectively route an event to one or more channels.

A fan-out flow using a (multiplexing) channel selector

The above example shows a source from agent "foo" fanning out the flow to three different channels. This fan out can be replicating or multiplexing. In case of replicating flow, each event is sent to all three channels. For the multiplexing case, an event is delivered to a subset of available channels when an event’s attribute matches a preconfigured value. For example, if an event attribute called "txnType" is set to "customer", then it should go to channel1 and channel3, if it’s "vendor" then it should go to channel2, otherwise channel3. The mapping can be set in the agent’s configuration file.

Spring Boot Setup

This content is provided by the Flume Spring Boot module. See Spring Boot Setup in the Flume Spring Boot documentation.

Configuration

As mentioned in the earlier section, standard Flume agent configuration is read from a file that resembles a Java property file format with hierarchical property settings.

Defining the flow

To define the flow within a single agent, you need to link the sources and sinks via a channel. You need to list the sources, sinks and channels for the given agent, and then point the source and sink to a channel. A source instance can specify multiple channels, but a sink instance can only specify one channel. The format is as follows:

  • Properties

  • YAML

  • JSON

# list the sources, sinks and channels for the agent
Agent.sources = Source
Agent.sinks = Sink
Agent.channels = Channel1 Channel2

# set channel for source
Agent.sources.Source.channels = Channel1 Channel2 ...

# set channel for sink
Agent.sinks.Sink.channel = Channel1
Agent:
  sources:
    Source:
      # set channel for source
      channels: Channel1 Channel2
  sinks:
    Sink:
      # set channel for sink
      channel: Channel1
"Agent": {
  "sources": {
    "Source": {
      "channels": "Channel1 Channel2"
    }
  },
  "sinks": {
    "Sink": {
      "channel": "Channel1"
    }
  }
}

For example, an agent named agent_foo is reading data from an external avro client and sending it to MongoDb via a memory channel. The config file weblog.config could look like:

  • Properties

  • YAML

  • JSON

# list the sources, sinks and channels for the agent
agent_foo.sources = avro-appserver-src-1
agent_foo.sinks = mongo-sink-1
agent_foo.channels = mem-channel-1

# set channel for source
agent_foo.sources.avro-appserver-src-1.channels = mem-channel-1

# set channel for sink
agent_foo.sinks.mongo-sink-1.channel = mem-channel-1
agent_foo:
  sources:
    avro-appserver-src-1:
      # set channel for source
      channels: mem-channel-1
  sinks:
    mongo-sink-1:
      # set channel for sink
      channel: mem-channel-1
  channels: mem-channel-1
"agent_foo": {
  "sources": {
    "avro-appserver-src-1": {
      "channels": "mem-channel-1"
    }
  },
  "sinks": {
    "mongo-sink-1": {
      "channel": "mem-channel-1"
    }
  },
  "channels": "mem-channel-1"
}

This will make the events flow from avro-AppSrv-source to mongodb-Cluster1-sink through the memory channel mem-channel-1. When the agent is started with the weblog.config as its config file, it will instantiate that flow.

Configuraton with YAML or JSON

As shown in A simple example Flume can also be configured using YAML or JSON. YAML is the preferred syntax for configuration as it is quite clear and is the easiest to create.

The main principle when creating YAML or JSON is that each token separated by a "." in a properties configuration represents a node in the YAML or JSON tree. For example, the configuration directly above in YAML would be:

agent_foo:
  sources:
    avro-appserver-src-1:
      channels: mem-channel-1
  sinks:
    mongo-sink-1:
      channel: mem-channel-1

Note that the list of source names, sink names, and channel names does not need to be declared as those will automatically be determined.

Configuring individual components

After defining the flow, you need to set properties of each source, sink and channel. This is done in the same hierarchical namespace fashion where you set the component type and other values for the properties specific to each component:

  • Properties

  • YAML

  • JSON

# properties for sources
Agent.sources.Source.someProperty = someValue

# properties for channels
Agent.channels.Channel.someProperty = someValue

# properties for sinks
Agent.sinks.Sink.someProperty = someValue
Agent:
  sources:
    Source:
      someProperty: someValue
  channels:
    Channel:
      someProperty: someValue
  sinks:
    Sink:
      someProperty: someValue
"Agent": {
  "sources": {
    "Source": {
      "someProperty": "someValue"
    }
  },
  "channels": {
    "Channel": {
      "someProperty": "someValue"
    }
  },
  "sinks": {
    "Sink": {
      "someProperty": "someValue"
    }
  }
}

The property named "type" needs to be set for each component for Flume to understand what kind of object it needs to be. Each source, sink and channel type has its own set of properties required for it to function as intended. All those need to be set as needed. In the previous example, we have a flow from avro-AppSrv-source to mongodb-Cluster1-sink through the memory channel mem-channel-1. Here’s an example that shows configuration of each of those components:

  • Properties

  • YAML

  • JSON

agent_foo.sources = avro-AppSrv-source
agent_foo.sinks = mongodb-Cluster1-sink
agent_foo.channels = mem-channel-1

# set channel for sources, sinks

# properties of avro-AppSrv-source
agent_foo.sources.avro-AppSrv-source.type = avro
agent_foo.sources.avro-AppSrv-source.bind = localhost
agent_foo.sources.avro-AppSrv-source.port = 10000
agent_foo.sources.avro-AppSrv-source.channels = mem-channel-1

# properties of mem-channel-1
agent_foo.channels.mem-channel-1.type = memory
agent_foo.channels.mem-channel-1.capacity = 1000
agent_foo.channels.mem-channel-1.transactionCapacity = 100

# properties of hdfs-Cluster1-sink
agent_foo.sinks.mongodb-Cluster1-sink.type = mongodb
agent_foo.sinks.mongodb-Cluster1-sink.channel = mem-channel-1
agent_foo.sinks.mongodb-Cluster1-sink.mongodb.uri = mongodb://localhost:27017
agent_foo.sinks.mongodb-Cluster1-sink.mongodb.database = Events
agent_foo.sinks.mongodb-Cluster1-sink.mongodb.collection: events
#...
agent_foo:
  sources:
    avro-AppSrv-source:
      type: avro
      bind: localhost
      port: 10000
      channels: mem-channel-1
  channels:
    mem-channel-1:
      type: memory
      capacity: 1000
      transactionCapacity: 100
  sinks:
    mongodb-Cluster1-sink:
      type: mongodb
      channel: mem-channel-1
      mongodb:
        uri: mongodb://localhost:27017
        database: Events
        collection: events
"agent_foo": {
  "sources": {
    "avro-AppSrv-source": {
      "type": "avro",
      "bind: "localhost",
      "port": 10000,
      "channels": "mem-channel-1"
    }
  },
  "channels": {
    "mem-channel-1": {
      "type": "memory",
      "capacity": 1000,
      "transactionCapacity": 100
    }
  },
  "sinks": {
    "mongodb-Cluster1-sink": {
      "type": "mongodb",
      "channel": "mem-channel-1",
      "mongodb": {
        "uri": "mongodb://localhost:27017",
        "database": "Events",
        "collection": "events"
      }
   }
}

Adding multiple flows in an agent

A single Flume agent can contain several independent flows. You can list multiple sources, sinks and channels in a config. These components can be linked to form multiple flows:

  • Properties

  • YAML

  • JSON

# list the sources, sinks and channels for the agent
Agent.sources = Source1 Source2
Agent.sinks = Sink1 Sink2
Agent.channels = Channel1 Channel2
# the sources, sinks and channels are derived from the components defined
Agent:
  sources:
    Source1:
      someProperty: someValue
    Source2:
      someProperty: someValue
  sinks:
    Sink1:
      someProperty: someValue
    Sink2:
      someProperty: someValue
  channels:
    Channel1:
      someProperty: someValue
    Channel2:
      someProperty: someValue
"Agent": {
  "sources": {
    "Source1": {
      "someProperty": "someValue"
    },
    "Source2": {
      "someProperty": "someValue"
    }
  },
  "sinks": {
    "Sink1": {
      "someProperty": "someValue"
    },
    "Sink2": {
      "someProperty": "someValue"
    }
  },
  "channels": {
    "Channel1": {
      "someProperty": "someValue"
    },
    "Channel2": {
      "someProperty": "someValue"
    }
  }
}

Then you can link the sources and sinks to their corresponding channels (for sources) or channel (for sinks) to setup two different flows. For example, if you need to setup two flows in an agent, one going from an external avro client to external HDFS and another from output of a tail to avro sink, then here’s a config to do that:

  • Properties

  • YAML

  • JSON

# list the sources, sinks and channels in the agent
agent_foo.sources = avro-AppSrv-source1 exec-tail-source2
agent_foo.sinks = hdfs-Cluster1-sink1 avro-forward-sink2
agent_foo.channels = mem-channel-1 file-channel-2

# flow #1 configuration
agent_foo.sources.avro-AppSrv-source1.channels = mem-channel-1
agent_foo.sinks.hdfs-Cluster1-sink1.channel = mem-channel-1

# flow #2 configuration
agent_foo.sources.exec-tail-source2.channels = file-channel-2
agent_foo.sinks.avro-forward-sink2.channel = file-channel-2
agent_foo:
  sources:
    avro-AppSrv-source1:
      # flow #1 configuration
      channels: mem-channel-1
    exec-tail-source2:
      # flow #2 configuration
      channels: file-channel-2
  sinks:
    hdfs-Cluster1-sink1:
      channel: mem-channel-1
    avro-forward-sink2:
      channel: file-channel-2
  channels: mem-channel-1 file-channel-2
"agent_foo": {
  "sources": {
    "avro-AppSrv-source1": {
      "channels": "mem-channel-1"
    },
    "exec-tail-source2": {
      "channels": "file-channel-2"
    }
  },
  "sinks": {
    "hdfs-Cluster1-sink1": {
      "channel": "mem-channel-1"
    },
    "avro-forward-sink2": {
      "channel": "file-channel-2"
    }
  },
  "channels": "mem-channel-1 file-channel-2"
}

Configuring a multi agent flow

To setup a multi-tier flow, you need to have an avro/thrift sink of first hop pointing to avro/thrift source of the next hop. This will result in the first Flume agent forwarding events to the next Flume agent. For example, if you are periodically sending files (1 file per event) using avro client to a local Flume agent, then this local agent can forward it to another agent that has the mounted for storage.

Weblog agent config:

  • Properties

  • YAML

  • JSON

# list sources, sinks and channels in the agent
agent_foo.sources = avro-AppSrv-source
agent_foo.sinks = avro-forward-sink
agent_foo.channels = file-channel

# define the flow
agent_foo.sources.avro-AppSrv-source.channels = file-channel
agent_foo.sinks.avro-forward-sink.channel = file-channel

# avro sink properties
agent_foo.sinks.avro-forward-sink.type = avro
agent_foo.sinks.avro-forward-sink.hostname = 10.1.1.100
agent_foo.sinks.avro-forward-sink.port = 10000

# configure other pieces
#...
agent_foo:
  sources:
    avro-AppSrv-source:
      # define the flow
      channels: file-channel
  sinks:
    avro-forward-sink:
      channel: file-channel
      # avro sink properties
      type: avro
      hostname: '10.1.1.100'
      port: 10000
  channels: file-channel
# configure other pieces
#...
"agent_foo": {
  "sources": {
    "avro-AppSrv-source": {
      "channels": "file-channel"
    }
  },
  "sinks": {
    "avro-forward-sink": {
      "channel": "file-channel",
      "type": "avro",
      "hostname": "10.1.1.100",
      "port": 10000
    }
  },
  "channels": "file-channel"
}

HDFS agent config:

  • Properties

  • YAML

  • JSON

# list sources, sinks and channels in the agent
agent_foo.sources = avro-collection-source
agent_foo.sinks = hdfs-sink
agent_foo.channels = mem-channel

# define the flow
agent_foo.sources.avro-collection-source.channels = mem-channel
agent_foo.sinks.hdfs-sink.channel = mem-channel

# avro source properties
agent_foo.sources.avro-collection-source.type = avro
agent_foo.sources.avro-collection-source.bind = 10.1.1.100
agent_foo.sources.avro-collection-source.port = 10000

# configure other pieces
#...
agent_foo:
  sources:
    avro-collection-source:
      # define the flow
      channels: mem-channel
      # avro source properties
      type: avro
      bind: '10.1.1.100'
      port: 10000
  sinks:
    hdfs-sink:
      channel: mem-channel
  channels: mem-channel
# configure other pieces
#...
"agent_foo": {
  "sources": {
    "avro-collection-source": {
      "channels": "mem-channel",
      "type": "avro",
      "bind": "10.1.1.100",
      "port": 10000
    }
  },
  "sinks": {
    "hdfs-sink": {
      "channel": "mem-channel"
    }
  },
  "channels": "mem-channel"
}

Here we link the avro-forward-sink from the weblog agent to the avro-collection-source of the hdfs agent. This will result in the events coming from the external appserver source eventually getting stored in HDFS.

Fan out flow

As discussed in previous section, Flume supports fanning out the flow from one source to multiple channels. There are two modes of fan out, replicating and multiplexing. In the replicating flow, the event is sent to all the configured channels. In case of multiplexing, the event is sent to only a subset of qualifying channels. To fan out the flow, one needs to specify a list of channels for a source and the policy for the fanning it out. This is done by adding a channel "selector" that can be replicating or multiplexing. Then further specify the selection rules if it’s a multiplexer. If you don’t specify a selector, then by default it’s replicating:

  • Properties

  • YAML

  • JSON

# List the sources, sinks and channels for the agent
Agent.sources = Source1
Agent.sinks = Sink1 Sink2
Agent.channels = Channel1 Channel2

# set list of channels for source (separated by space)
Agent.sources.Source1.channels = Channel1 Channel2

# set channel for sinks
Agent.sinks.Sink1.channel = Channel1
Agent.sinks.Sink2.channel = Channel2

Agent.sources.Source1.selector.type = replicating
Agent:
  sources:
    Source1:
      # set list of channels for source (separated by space)
      channels: Channel1 Channel2
      selector:
        type: replicating
  sinks:
    # set channel for sinks
    Sink1:
      channel: Channel1
    Sink2:
      channel: Channel2
"Agent": {
  "sources": {
    "Source1": {
      "channels": "Channel1 Channel2",
      "selector": {
        "type": "replicating"
      }
    }
  },
  "sinks": {
    "Sink1": {
      "channel": "Channel1"
    },
    "Sink2": {
      "channel": "Channel2"
    }
  }
}

The multiplexing select has a further set of properties to bifurcate the flow. This requires specifying a mapping of an event attribute to a set for channel. The selector checks for each configured attribute in the event header. If it matches the specified value, then that event is sent to all the channels mapped to that value. If there’s no match, then the event is sent to set of channels configured as default:

  • Properties

  • YAML

  • JSON

# Mapping for multiplexing selector
Agent.sources.Source1.selector.type = multiplexing
Agent.sources.Source1.selector.header = someHeader
Agent.sources.Source1.selector.mapping.Value1 = Channel1
Agent.sources.Source1.selector.mapping.Value2 = Channel1 Channel2
Agent.sources.Source1.selector.mapping.Value3 = Channel2
# ...

Agent.sources.Source1.selector.default = Channel2
# Mapping for multiplexing selector
Agent:
  sources:
    Source1:
      selector:
        type: multiplexing
        header: someHeader
        mapping:
          Value1: Channel1
          Value2: Channel1 Channel2
          Value3: Channel2
          # ...
        default: Channel2
"Agent": {
  "sources": {
    "Source1": {
      "selector": {
        "type": "multiplexing",
        "header": "someHeader",
        "mapping": {
          "Value1": "Channel1",
          "Value2": "Channel1 Channel2",
          "Value3": "Channel2"
        },
        "default": "Channel2"
      }
    }
  }
}

The mapping allows overlapping the channels for each value.

The following example has a single flow that multiplexed to two paths. The agent named agent_foo has a single avro source and two channels linked to two sinks:

  • Properties

  • YAML

  • JSON

# list the sources, sinks and channels in the agent
agent_foo.sources = avro-AppSrv-source1
agent_foo.sinks = hdfs-Cluster1-sink1 avro-forward-sink2
agent_foo.channels = mem-channel-1 file-channel-2

# set channels for source
agent_foo.sources.avro-AppSrv-source1.channels = mem-channel-1 file-channel-2

# set channel for sinks
agent_foo.sinks.hdfs-Cluster1-sink1.channel = mem-channel-1
agent_foo.sinks.avro-forward-sink2.channel = file-channel-2

# channel selector configuration
agent_foo.sources.avro-AppSrv-source1.selector.type = multiplexing
agent_foo.sources.avro-AppSrv-source1.selector.header = State
agent_foo.sources.avro-AppSrv-source1.selector.mapping.CA = mem-channel-1
agent_foo.sources.avro-AppSrv-source1.selector.mapping.AZ = file-channel-2
agent_foo.sources.avro-AppSrv-source1.selector.mapping.NY = mem-channel-1 file-channel-2
agent_foo.sources.avro-AppSrv-source1.selector.default = mem-channel-1
agent_foo:
  sources:
    avro-AppSrv-source1:
      # set channels for source
      channels: mem-channel-1 file-channel-2
      selector:
        # channel selector configuration
        type: multiplexing
        header: State
        mapping:
          CA: mem-channel-1
          AZ: file-channel-2
          NY: mem-channel-1 file-channel-2
        default: mem-channel-1
  sinks:
    hdfs-Cluster1-sink1:
      # set channel for sinks
      channel: mem-channel-1
    avro-forward-sink2:
      channel: file-channel-2
  channels: mem-channel-1 file-channel-2
"agent_foo": {
  "sources": {
    "avro-AppSrv-source1": {
      "channels": "mem-channel-1 file-channel-2",
      "selector": {
        "type": "multiplexing",
        "header": "State",
        "mapping": {
          "CA": "mem-channel-1",
          "AZ": "file-channel-2",
          "NY": "mem-channel-1 file-channel-2"
        },
        "default": "mem-channel-1"
      }
    }
  },
  "sinks": {
    "hdfs-Cluster1-sink1": {
      "channel": "mem-channel-1"
    },
    "avro-forward-sink2": {
      "channel": "file-channel-2"
    }
  },
  "channels": "mem-channel-1 file-channel-2"
}

The selector checks for a header called "State". If the value is "CA" then its sent to mem-channel-1, if its "AZ" then it goes to file-channel-2 or if its "NY" then both. If the "State" header is not set or doesn’t match any of the three, then it goes to mem-channel-1 which is designated as 'default'.

The selector also supports optional channels. To specify optional channels for a header, the config parameter 'optional' is used in the following way:

  • Properties

  • YAML

  • JSON

# channel selector configuration
agent_foo.sources.avro-AppSrv-source1.selector.type = multiplexing
agent_foo.sources.avro-AppSrv-source1.selector.header = State
agent_foo.sources.avro-AppSrv-source1.selector.mapping.CA = mem-channel-1
agent_foo.sources.avro-AppSrv-source1.selector.mapping.AZ = file-channel-2
agent_foo.sources.avro-AppSrv-source1.selector.mapping.NY = mem-channel-1 file-channel-2
agent_foo.sources.avro-AppSrv-source1.selector.optional.CA = mem-channel-1 file-channel-2
agent_foo.sources.avro-AppSrv-source1.selector.mapping.AZ = file-channel-2
agent_foo.sources.avro-AppSrv-source1.selector.default = mem-channel-1
# channel selector configuration
agent_foo:
  sources:
    avro-AppSrv-source1:
      selector:
        type: multiplexing
        header: State
        mapping:
          CA: mem-channel-1
          AZ: file-channel-2
          NY: mem-channel-1 file-channel-2
        optional:
          CA: mem-channel-1 file-channel-2
        default: mem-channel-1
"agent_foo": {
  "sources": {
    "avro-AppSrv-source1": {
      "selector": {
        "type": "multiplexing",
        "header": "State",
        "mapping": {
          "CA": "mem-channel-1",
          "AZ": "file-channel-2",
          "NY": "mem-channel-1 file-channel-2"
        },
        "optional": {
          "CA": "mem-channel-1 file-channel-2"
        },
        "default": "mem-channel-1"
      }
    }
  }
}

The selector will attempt to write to the required channels first and will fail the transaction if even one of these channels fails to consume the events. The transaction is reattempted on all of the channels. Once all required channels have consumed the events, then the selector will attempt to write to the optional channels. A failure by any of the optional channels to consume the event is simply ignored and not retried.

If there is an overlap between the optional channels and required channels for a specific header, the channel is considered to be required, and a failure in the channel will cause the entire set of required channels to be retried. For instance, in the above example, for the header "CA" mem-channel-1 is considered to be a required channel even though it is marked both as required and optional, and a failure to write to this channel will cause that event to be retried on all channels configured for the selector.

Note that if a header does not have any required channels, then the event will be written to the default channels and will be attempted to be written to the optional channels for that header. Specifying optional channels will still cause the event to be written to the default channels, if no required channels are specified. If no channels are designated as default and there are no required, the selector will attempt to write the events to the optional channels. Any failures are simply ignored in that case.

SSL/TLS support

Several Flume components support the SSL/TLS protocols in order to communicate with other systems securely.

Component SSL server or client

Avro Source

server

Avro Sink

client

Thrift Source

server

Thrift Sink

client

Kafka Source

client

Kafka Channel

client

Kafka Sink

client

JMS Source

client

Syslog TCP Source

server

Multiport Syslog TCP Source

server

The SSL compatible components have several configuration parameters to set up SSL, like enable SSL flag, keystore / truststore parameters (location, password, type) and additional SSL parameters (eg. disabled protocols).

Enabling SSL for a component is always specified at component level in the agent configuration file. So some components may be configured to use SSL while others not (even with the same component type).

The keystore / truststore setup can be specified at component level or globally.

In case of the component level setup, the keystore / truststore is configured in the agent configuration file through component specific parameters. The advantage of this method is that the components can use different keystores (if this would be needed). The disadvantage is that the keystore parameters must be copied for each component in the agent configuration file. The component level setup is optional, but if it is defined, it has higher precedence than the global parameters.

With the global setup, it is enough to define the keystore / truststore parameters once and use the same settings for all components, which means less and more centralized configuration.

The global setup can be configured either through system properties or through environment variables.

System property Environment variable Description

javax.net.ssl.keyStore

FLUME_SSL_KEYSTORE_PATH

Keystore location

javax.net.ssl.keyStorePassword

FLUME_SSL_KEYSTORE_PASSWORD

Keystore password

javax.net.ssl.keyStoreType

FLUME_SSL_KEYSTORE_TYPE

Keystore type (by default JKS)

javax.net.ssl.trustStore

FLUME_SSL_TRUSTSTORE_PATH

Truststore location

javax.net.ssl.trustStorePassword

FLUME_SSL_TRUSTSTORE_PASSWORD

Truststore password

javax.net.ssl.trustStoreType

FLUME_SSL_TRUSTSTORE_TYPE

Truststore type (by default JKS)

flume.ssl.include.protocols

FLUME_SSL_INCLUDE_PROTOCOLS

Protocols to include when calculating enabled protocols. A comma (,) separated list. Excluded protocols will be excluded from this list if provided.

flume.ssl.exclude.protocols

FLUME_SSL_EXCLUDE_PROTOCOLS

Protocols to exclude when calculating enabled protocols. A comma (,) separated list.

flume.ssl.include.cipherSuites

FLUME_SSL_INCLUDE_CIPHERSUITES

Cipher suites to include when calculating enabled cipher suites. A comma (,) separated list. Excluded cipher suites will be excluded from this list if provided.

flume.ssl.exclude.cipherSuites

FLUME_SSL_EXCLUDE_CIPHERSUITES

Cipher suites to exclude when calculating enabled cipher suites. A comma (,) separated list.

The SSL system properties can either be passed on the command line or by setting the JAVA_OPTS environment variable in conf/flume-env.sh. (Although, using the command line is inadvisable because the commands including the passwords will be saved to the command history.)

export JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.keyStore=/path/to/keystore.jks"
export JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.keyStorePassword=password"

Flume uses the system properties defined in JSSE (Java Secure Socket Extension), so this is a standard way for setting up SSL. On the other hand, specifying passwords in system properties means that the passwords can be seen in the process list. For cases where it is not acceptable, it is also be possible to define the parameters in environment variables. Flume initializes the JSSE system properties from the corresponding environment variables internally in this case.

The SSL environment variables can either be set in the shell environment before starting Flume or in conf/flume-env.sh. (Although, using the command line is inadvisable because the commands including the passwords will be saved to the command history.)

export FLUME_SSL_KEYSTORE_PATH=/path/to/keystore.jks
export FLUME_SSL_KEYSTORE_PASSWORD=password

Please note:

  • SSL must be enabled at component level. Specifying the global SSL parameters alone will not have any effect.

  • If the global SSL parameters are specified at multiple levels, the priority is the following (from higher to lower):

    • component parameters in agent config

    • system properties

    • environment variables

  • If SSL is enabled for a component, but the SSL parameters are not specified in any of the ways described above, then

    • in case of keystores: configuration error

    • in case of truststores: the default truststore will be used (jssecacerts / cacerts in Oracle JDK)

  • The trustore password is optional in all cases. If not specified, then no integrity check will be performed on the truststore when it is opened by the JDK.

Source and sink batch sizes and channel transaction capacities

Sources and sinks can have a batch size parameter that determines the maximum number of events they process in one batch. This happens within a channel transaction that has an upper limit called transaction capacity. Batch size must be smaller than the channel’s transaction capacity. There is an explicit check to prevent incompatible settings. This check happens whenever the configuration is read.

Flume Sources

Avro Source

This content is provided by the Flume RPC module. See Avro Source in the Flume RPC documentation.

Thrift Source

This content is provided by the Flume RPC module. See Thrift Source in the Flume RPC documentation.

Exec Source

Exec source runs a given Unix command on start-up and expects that process to continuously produce data on standard out (stderr is simply discarded, unless property logStdErr is set to true). If the process exits for any reason, the source also exits and will produce no further data. This means configurations such as cat [named pipe] or tail -F [file] are going to produce the desired results where as date will probably not - the former two commands produce streams of data where as the latter produces a single event and exits.

Required properties are in bold.

Property Name Default Description

channels

 — 

type

 — 

The component type name, needs to be exec

command

 — 

The command to execute

shell

 — 

A shell invocation used to run the command. e.g. /bin/sh -c. Required only for commands relying on shell features like wildcards, back ticks, pipes etc.

restartThrottle

10000

Amount of time (in millis) to wait before attempting a restart

restart

false

Whether the executed cmd should be restarted if it dies

logStdErr

false

Whether the command’s stderr should be logged

batchSize

20

The max number of lines to read and send to the channel at a time

batchTimeout

3000

Amount of time (in milliseconds) to wait, if the buffer size was not reached, before data is pushed downstream

selector.type

replicating

replicating or multiplexing

selector.*

Depends on the selector.type value

interceptors

 — 

Space-separated list of interceptors

interceptors.*

The problem with ExecSource and other asynchronous sources is that the source can not guarantee that if there is a failure to put the event into the Channel the client knows about it. In such cases, the data will be lost. As a for instance, one of the most commonly requested features is the tail -F [file]-like use case where an application writes to a log file on disk and Flume tails the file, sending each line as an event. While this is possible, there’s an obvious problem; what happens if the channel fills up and Flume can’t send an event? Flume has no way of indicating to the application writing the log file that it needs to retain the log or that the event hasn’t been sent, for some reason. If this doesn’t make sense, you need only know this: Your application can never guarantee data has been received when using a unidirectional asynchronous interface such as ExecSource! As an extension of this warning - and to be completely clear - there is absolutely zero guarantee of event delivery when using this source. For stronger reliability guarantees, consider the Spooling Directory Source, Taildir Source or direct integration with Flume via the SDK.

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.sources.r1.type = exec
a1.sources.r1.command = tail -F /var/log/secure
a1.sources.r1.channels = c1
a1:
  sources:
    r1:
      type: exec
      command: tail -F /var/log/secure
      channels: c1
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "type": "exec",
      "command": "tail -F /var/log/secure",
      "channels": "c1"
    }
  },
  "channels": "c1"
}

The 'shell' config is used to invoke the 'command' through a command shell (such as Bash or Powershell). The 'command' is passed as an argument to 'shell' for execution. This allows the 'command' to use features from the shell such as wildcards, back ticks, pipes, loops, conditionals etc. In the absence of the 'shell' config, the 'command' will be invoked directly. Common values for 'shell' : '/bin/sh -c', '/bin/ksh -c', 'cmd /c', 'powershell -Command', etc.

  • Properties

  • YAML

  • JSON

a1.sources.tailsource-1.type = exec
a1.sources.tailsource-1.shell = /bin/bash -c
a1.sources.tailsource-1.command = for i in /path/*.txt; do cat $i; done
a1:
  sources:
    tailsource-1:
      type: exec
      shell: /bin/bash -c
      command: for i in /path/*.txt; do cat $i; done
"a1": {
  "sources": {
    "tailsource-1": {
      "type": "exec",
      "shell": "/bin/bash -c",
      "command": "for i in /path/*.txt; do cat $i; done"
    }
  }
}

JMS Source

This content is provided by the Flume JMS module. See JMS Source in the Flume JMS documentation.

Spooling Directory Source

This content is provided by the Flume RPC module. See Spooling Directory Source in the Flume RPC documentation.

Taildir Source

This source is provided as a preview feature.

This source tracks files by their inode number and therefore requires a file system that provides the unix file attribute view. In particular, it does not work on Windows.

Watch the specified files, and tail them in nearly real-time once detected new lines appended to the each files. If the new lines are being written, this source will retry reading them in wait for the completion of the write.

This source is reliable and will not miss data even when the tailing files rotate. It periodically writes the last read position of each files on the given position file in JSON format. If Flume is stopped or down for some reason, it can restart tailing from the position written on the existing position file.

In other use case, this source can also start tailing from the arbitrary position for each files using the given position file. When there is no position file on the specified path, it will start tailing from the first line of each files by default.

Files will be consumed in order of their modification time. File with the oldest modification time will be consumed first.

This source does not rename or delete or do any modifications to the file being tailed. Currently this source does not support tailing binary files. It reads text files line by line.

Property Name Default Description

channels

 — 

type

 — 

The component type name, needs to be TAILDIR.

filegroups

 — 

Space-separated list of file groups. Each file group indicates a set of files to be tailed.

filegroups.<filegroupName>

 — 

Absolute path of the file group. Regular expression (and not file system patterns) can be used for filename only.

positionFile

~/.flume/taildir_position.json

File in JSON format to record the inode, the absolute path and the last position of each tailing file.

headers.<filegroupName>.<headerKey>

 — 

Header value which is the set with header key. Multiple headers can be specified for one file group.

byteOffsetHeader

false

Whether to add the byte offset of a tailed line to a header called 'byteoffset'.

skipToEnd

false

Whether to skip the position to EOF in the case of files not written on the position file.

idleTimeout

120000

Time (ms) to close inactive files. If the closed file is appended new lines to, this source will automatically re-open it.

writePosInterval

3000

Interval time (ms) to write the last position of each file on the position file.

batchSize

100

Max number of lines to read and send to the channel at a time. Using the default is usually fine.

maxBatchCount

Long.MAX_VALUE

Controls the number of batches being read consecutively from the same file. If the source is tailing multiple files and one of them is written at a fast rate, it can prevent other files to be processed, because the busy file would be read in an endless loop. In this case lower this value.

backoffSleepIncrement

1000

The increment for time delay before reattempting to poll for new data, when the last attempt did not find any new data.

maxBackoffSleep

5000

The max time delay between each reattempt to poll for new data, when the last attempt did not find any new data.

cachePatternMatching

true

Listing directories and applying the filename regex pattern may be time consuming for directories containing thousands of files. Caching the list of matching files can improve performance. The order in which files are consumed will also be cached. Requires that the file system keeps track of modification times with at least a 1-second granularity.

fileHeader

false

Whether to add a header storing the absolute path filename.

fileHeaderKey

file

Header key to use when appending absolute path filename to event header.

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.sources.r1.type = TAILDIR
a1.sources.r1.channels = c1
a1.sources.r1.positionFile = /var/log/flume/taildir_position.json
a1.sources.r1.filegroups = f1 f2
a1.sources.r1.filegroups.f1 = /var/log/test1/example.log
a1.sources.r1.headers.f1.headerKey1 = value1
a1.sources.r1.filegroups.f2 = /var/log/test2/.*log.*
a1.sources.r1.headers.f2.headerKey1 = value2
a1.sources.r1.headers.f2.headerKey2 = value2-2
a1.sources.r1.fileHeader = true
a1.sources.r1.maxBatchCount = 1000
a1:
  sources:
    r1:
      type: TAILDIR
      channels: c1
      positionFile: /var/log/flume/taildir_position.json
      filegroups: f1 f2
      filegroups.f1: /var/log/test1/example.log
      filegroups.f2: /var/log/test2/.*log.*
      headers:
        f1:
          headerKey1: value1
        f2:
          headerKey1: value2
          headerKey2: value2-2
      fileHeader: true
      maxBatchCount: 1000
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "type": "TAILDIR",
      "channels": "c1",
      "positionFile": "/var/log/flume/taildir_position.json",
      "filegroups": "f1 f2",
      "filegroups.f1": "/var/log/test1/example.log",
      "filegroups.f2": "/var/log/test2/.*log.*",
      "headers": {
        "f1": {
          "headerKey1": "value1"
        },
        "f2": {
          "headerKey1": "value2",
          "headerKey2": "value2-2"
        }
      },
      "fileHeader": true,
      "maxBatchCount": 1000
    }
  },
  "channels": "c1"
}

Kafka Source

This content is provided by the Flume Kafka module. See Kafka Source in the Flume Kafka documentation.

NetCat TCP Source

A netcat-like source that listens on a given port and turns each line of text into an event. Acts like nc -k -l [host] [port]. In other words, it opens a specified port and listens for data. The expectation is that the supplied data is newline separated text. Each line of text is turned into a Flume event and sent via the connected channel.

Required properties are in bold.

Property Name Default Description

channels

 — 

type

 — 

The component type name, needs to be netcat

bind

 — 

Host name or IP address to bind to

port

 — 

Port # to bind to

max-line-length

512

Max line length per event body (in bytes)

ack-every-event

true

Respond with an "OK" for every event received

selector.type

replicating

replicating or multiplexing

selector.*

Depends on the selector.type value

interceptors

 — 

Space-separated list of interceptors

interceptors.*

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.sources.r1.type = netcat
a1.sources.r1.bind = 0.0.0.0
a1.sources.r1.port = 6666
a1.sources.r1.channels = c1
a1:
  sources:
    r1:
      type: netcat
      bind: '0.0.0.0'
      port: 6666
      channels: c1
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "type": "netcat",
      "bind": "0.0.0.0",
      "port": 6666,
      "channels": "c1"
    }
  },
  "channels": "c1"
}

NetCat UDP Source

As per the original Netcat (TCP) source, this source that listens on a given port and turns each line of text into an event and sent via the connected channel. Acts like nc -u -k -l [host] [port].

Required properties are in bold.

Property Name Default Description

channels

 — 

type

 — 

The component type name, needs to be netcatudp

bind

 — 

Host name or IP address to bind to

port

 — 

Port # to bind to

remoteAddressHeader

 — 

selector.type

replicating

replicating or multiplexing

selector.*

Depends on the selector.type value

interceptors

 — 

Space-separated list of interceptors

interceptors.*

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.sources.r1.type = netcatudp
a1.sources.r1.bind = 0.0.0.0
a1.sources.r1.port = 6666
a1.sources.r1.channels = c1
a1:
  sources:
    r1:
      type: netcatudp
      bind: '0.0.0.0'
      port: 6666
      channels: c1
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "type": "netcatudp",
      "bind": "0.0.0.0",
      "port": 6666,
      "channels": "c1"
    }
  },
  "channels": "c1"
}

Sequence Generator Source

A simple sequence generator that continuously generates events with a counter that starts from 0, increments by 1 and stops at totalEvents. Retries when it can’t send events to the channel. Useful mainly for testing. During retries it keeps the body of the retried messages the same as before so that the number of unique events - after de-duplication at destination - is expected to be equal to the specified totalEvents. Required properties are in bold.

Property Name Default Description

channels

 — 

type

 — 

The component type name, needs to be seq

selector.type

replicating or multiplexing

selector.*

replicating

Depends on the selector.type value

interceptors

 — 

Space-separated list of interceptors

interceptors.*

batchSize

1

Number of events to attempt to process per request loop.

totalEvents

Long.MAX_VALUE

Number of unique events sent by the source.

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.sources.r1.type = seq
a1.sources.r1.channels = c1
a1:
  sources:
    r1:
      type: seq
      channels: c1
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "type": "seq",
      "channels": "c1"
    }
  },
  "channels": "c1"
}

Syslog Sources

Reads syslog data and generate Flume events. The UDP source treats an entire message as a single event. The TCP sources create a new event for each string of characters separated by a newline ('n').

Required properties are in bold.

Syslog TCP Source

The original, tried-and-true syslog TCP source.

Property Name Default Description

channels

 — 

type

 — 

The component type name, needs to be syslogtcp

host

 — 

Host name or IP address to bind to

port

 — 

Port # to bind to

eventSize

2500

Maximum size of a single event line, in bytes

keepFields

none

Setting this to 'all' will preserve the Priority, Timestamp and Hostname in the body of the event. A spaced separated list of fields to include is allowed as well. Currently, the following fields can be included: priority, version, timestamp, hostname. The values 'true' and 'false' have been deprecated in favor of 'all' and 'none'.

clientIPHeader

 — 

If specified, the IP address of the client will be stored in the header of each event using the header name specified here. This allows for interceptors and channel selectors to customize routing logic based on the IP address of the client. Do not use the standard Syslog header names here (like host_) because the event header will be overridden in that case.

clientHostnameHeader

 — 

If specified, the host name of the client will be stored in the header of each event using the header name specified here. This allows for interceptors and channel selectors to customize routing logic based on the host name of the client. Retrieving the host name may involve a name service reverse lookup which may affect the performance. Do not use the standard Syslog header names here (like host_) because the event header will be overridden in that case.

selector.type

replicating or multiplexing

selector.*

replicating

Depends on the selector.type value

interceptors

 — 

Space-separated list of interceptors

interceptors.*

ssl

false

Set this to true to enable SSL encryption. If SSL is enabled, you must also specify a "keystore" and a "keystore-password", either through component level parameters (see below) or as global SSL parameters (see SSL/TLS support section).

keystore

 — 

This is the path to a Java keystore file. If not specified here, then the global keystore will be used (if defined, otherwise configuration error).

keystore-password

 — 

The password for the Java keystore. If not specified here, then the global keystore password will be used (if defined, otherwise configuration error).

keystore-type

JKS

The type of the Java keystore. This can be "JKS" or "PKCS12". If not specified here, then the global keystore type will be used (if defined, otherwise the default is JKS).

exclude-protocols

SSLv3

Space-separated list of SSL/TLS protocols to exclude. SSLv3 will always be excluded in addition to the protocols specified.

include-protocols

 — 

Space-separated list of SSL/TLS protocols to include. The enabled protocols will be the included protocols without the excluded protocols. If included-protocols is empty, it includes every supported protocols.

exclude-cipher-suites

 — 

Space-separated list of cipher suites to exclude.

include-cipher-suites

 — 

Space-separated list of cipher suites to include. The enabled cipher suites will be the included cipher suites without the excluded cipher suites. If included-cipher-suites is empty, it includes every supported cipher suites.

For example, a syslog TCP source for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.sources.r1.type = syslogtcp
a1.sources.r1.port = 5140
a1.sources.r1.host = localhost
a1.sources.r1.channels = c1
a1:
  sources:
    r1:
      type: syslogtcp
      port: 5140
      host: localhost
      channels: c1
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "type": "syslogtcp",
      "port": 5140,
      "host": "localhost",
      "channels": "c1"
    }
  },
  "channels": "c1"
}
Multiport Syslog TCP Source

This is a newer, faster, multi-port capable version of the Syslog TCP source. Note that the ports configuration setting has replaced port. Multi-port capability means that it can listen on many ports at once in an efficient manner. This source uses the Apache Mina library to do that. Provides support for RFC-3164 and many common RFC-5424 formatted messages. Also provides the capability to configure the character set used on a per-port basis.

Property Name Default Description

channels

 — 

type

 — 

The component type name, needs to be multiport_syslogtcp

host

 — 

Host name or IP address to bind to.

ports

 — 

Space-separated list (one or more) of ports to bind to.

eventSize

2500

Maximum size of a single event line, in bytes.

keepFields

none

Setting this to 'all' will preserve the Priority, Timestamp and Hostname in the body of the event. A spaced separated list of fields to include is allowed as well. Currently, the following fields can be included: priority, version, timestamp, hostname. The values 'true' and 'false' have been deprecated in favor of 'all' and 'none'.

portHeader

 — 

If specified, the port number will be stored in the header of each event using the header name specified here. This allows for interceptors and channel selectors to customize routing logic based on the incoming port.

clientIPHeader

 — 

If specified, the IP address of the client will be stored in the header of each event using the header name specified here. This allows for interceptors and channel selectors to customize routing logic based on the IP address of the client. Do not use the standard Syslog header names here (like host_) because the event header will be overridden in that case.

clientHostnameHeader

 — 

If specified, the host name of the client will be stored in the header of each event using the header name specified here. This allows for interceptors and channel selectors to customize routing logic based on the host name of the client. Retrieving the host name may involve a name service reverse lookup which may affect the performance. Do not use the standard Syslog header names here (like host_) because the event header will be overridden in that case.

charset.default

UTF-8

Default character set used while parsing syslog events into strings.

charset.port.<port>

 — 

Character set is configurable on a per-port basis.

batchSize

100

Maximum number of events to attempt to process per request loop. Using the default is usually fine.

readBufferSize

1024

Size of the internal Mina read buffer. Provided for performance tuning. Using the default is usually fine.

numProcessors

(auto-detected)

Number of processors available on the system for use while processing messages. Default is to auto-detect # of CPUs using the Java Runtime API. Mina will spawn 2 request-processing threads per detected CPU, which is often reasonable.

selector.type

replicating

replicating, multiplexing, or custom

selector.*

 — 

Depends on the selector.type value

interceptors

 — 

Space-separated list of interceptors.

interceptors.*

ssl

false

Set this to true to enable SSL encryption. If SSL is enabled, you must also specify a "keystore" and a "keystore-password", either through component level parameters (see below) or as global SSL parameters (see SSL/TLS support section).

keystore

 — 

This is the path to a Java keystore file. If not specified here, then the global keystore will be used (if defined, otherwise configuration error).

keystore-password

 — 

The password for the Java keystore. If not specified here, then the global keystore password will be used (if defined, otherwise configuration error).

keystore-type

JKS

The type of the Java keystore. This can be "JKS" or "PKCS12". If not specified here, then the global keystore type will be used (if defined, otherwise the default is JKS).

exclude-protocols

SSLv3

Space-separated list of SSL/TLS protocols to exclude. SSLv3 will always be excluded in addition to the protocols specified.

include-protocols

 — 

Space-separated list of SSL/TLS protocols to include. The enabled protocols will be the included protocols without the excluded protocols. If included-protocols is empty, it includes every supported protocols.

exclude-cipher-suites

 — 

Space-separated list of cipher suites to exclude.

include-cipher-suites

 — 

Space-separated list of cipher suites to include. The enabled cipher suites will be the included cipher suites without the excluded cipher suites. If included-cipher-suites is empty, it includes every supported cipher suites.

For example, a multiport syslog TCP source for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.sources.r1.type = multiport_syslogtcp
a1.sources.r1.channels = c1
a1.sources.r1.host = 0.0.0.0
a1.sources.r1.ports = 10001 10002 10003
a1.sources.r1.portHeader = port
a1:
  sources:
    r1:
      type: multiport_syslogtcp
      channels: c1
      host: '0.0.0.0'
      ports: 10001 10002 10003
      portHeader: port
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "type": "multiport_syslogtcp",
      "channels": "c1",
      "host": "0.0.0.0",
      "ports": "10001 10002 10003",
      "portHeader": "port"
    }
  },
  "channels": "c1"
}
Syslog UDP Source
Property Name Default Description

channels

 — 

type

 — 

The component type name, needs to be syslogudp

host

 — 

Host name or IP address to bind to

port

 — 

Port # to bind to

keepFields

false

Setting this to true will preserve the Priority, Timestamp and Hostname in the body of the event.

clientIPHeader

 — 

If specified, the IP address of the client will be stored in the header of each event using the header name specified here. This allows for interceptors and channel selectors to customize routing logic based on the IP address of the client. Do not use the standard Syslog header names here (like host_) because the event header will be overridden in that case.

clientHostnameHeader

 — 

If specified, the host name of the client will be stored in the header of each event using the header name specified here. This allows for interceptors and channel selectors to customize routing logic based on the host name of the client. Retrieving the host name may involve a name service reverse lookup which may affect the performance. Do not use the standard Syslog header names here (like host_) because the event header will be overridden in that case.

selector.type

replicating or multiplexing

selector.*

replicating

Depends on the selector.type value

interceptors

 — 

Space-separated list of interceptors

interceptors.*

For example, a syslog UDP source for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.sources.r1.type = syslogudp
a1.sources.r1.port = 5140
a1.sources.r1.host = localhost
a1.sources.r1.channels = c1
a1:
  sources:
    r1:
      type: syslogudp
      port: 5140
      host: localhost
      channels: c1
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "type": "syslogudp",
      "port": 5140,
      "host": "localhost",
      "channels": "c1"
    }
  },
  "channels": "c1"
}

HTTP Source

This content is provided by the Flume HTTP module. See HTTP Source in the Flume HTTP documentation.

Custom Source

A custom source is your own implementation of the Source interface. A custom source’s class and its dependencies must be included in the agent’s classpath when starting the Flume agent. The type of the custom source is its FQCN.

Property Name Default Description

channels

 — 

type

 — 

The component type name, needs to be your FQCN

selector.type

replicating or multiplexing

selector.*

replicating

Depends on the selector.type value

interceptors

 — 

Space-separated list of interceptors

interceptors.*

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.sources.r1.type = org.example.MySource
a1.sources.r1.channels = c1
a1:
  sources:
    r1:
      type: org.example.MySource
      channels: c1
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "type": "org.example.MySource",
      "channels": "c1"
    }
  },
  "channels": "c1"
}

Scribe Source

Scribe is another type of ingest system. To adopt existing Scribe ingest system, Flume should use ScribeSource based on Thrift with compatible transfering protocol. For deployment of Scribe please follow the guide from Facebook. Required properties are in bold.

Property Name Default Description

type

 — 

The component type name, needs to be org.apache.flume.source.scribe.ScribeSource

port

1499

Port that Scribe should be connected

maxReadBufferBytes

16384000

Thrift Default FrameBuffer Size

workerThreads

5

Handing threads number in Thrift

selector.type

selector.*

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.sources.r1.type = org.apache.flume.source.scribe.ScribeSource
a1.sources.r1.port = 1463
a1.sources.r1.workerThreads = 5
a1.sources.r1.channels = c1
a1:
  sources:
    r1:
      type: org.apache.flume.source.scribe.ScribeSource
      port: 1463
      workerThreads: 5
      channels: c1
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "type": "org.apache.flume.source.scribe.ScribeSource",
      "port": 1463,
      "workerThreads": 5,
      "channels": "c1"
    }
  },
  "channels": "c1"
}

Flume Sinks

Logger Sink

Logs event at INFO level. Typically useful for testing/debugging purpose. Required properties are in bold. This sink is the only exception which doesn’t require the extra configuration explained in the Logging raw data section.

Property Name Default Description

channel

 — 

type

 — 

The component type name, needs to be logger

maxBytesToLog

16

Maximum number of bytes of the Event body to log

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.channels = c1
a1.sinks = k1
a1.sinks.k1.type = logger
a1.sinks.k1.channel = c1
a1:
  channels: c1
  sinks:
    k1:
      type: logger
      channel: c1
"a1": {
  "channels": "c1",
  "sinks": {
    "k1": {
      "type": "logger",
      "channel": "c1"
    }
  }
}

Avro Sink

This content is provided by the Flume RPC module. See Avro Sink in the Flume RPC documentation.

Thrift Sink

This content is provided by the Flume RPC module. See Thrift Sink in the Flume RPC documentation.

File Roll Sink

Stores events on the local filesystem. Required properties are in bold.

Property Name Default Description

channel

 — 

type

 — 

The component type name, needs to be file_roll.

sink.directory

 — 

The directory where files will be stored

sink.pathManager

DEFAULT

The PathManager implementation to use.

sink.pathManager.extension

 — 

The file extension if the default PathManager is used.

sink.pathManager.prefix

 — 

A character string to add to the beginning of the file name if the default PathManager is used

sink.rollInterval

30

Roll the file every 30 seconds. Specifying 0 will disable rolling and cause all events to be written to a single file.

sink.serializer

TEXT

Other possible options include avro_event or the FQCN of an implementation of EventSerializer.Builder interface.

sink.batchSize

100

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.channels = c1
a1.sinks = k1
a1.sinks.k1.type = file_roll
a1.sinks.k1.channel = c1
a1.sinks.k1.sink.directory = /var/log/flume
a1:
  channels: c1
  sinks:
    k1:
      type: file_roll
      channel: c1
      sink:
        directory: /var/log/flume
"a1": {
  "channels": "c1",
  "sinks": {
    "k1": {
      "type": "file_roll",
      "channel": "c1",
      "sink": {
        "directory": "/var/log/flume"
      }
    }
  }
}

MongoDb Sink

This content is provided by the Flume MongoDB module. See MongoDb Sink in the Flume MongoDB documentation.

Null Sink

Discards all events it receives from the channel. Required properties are in bold.

Property Name Default Description

channel

 — 

type

 — 

The component type name, needs to be null.

batchSize

100

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.channels = c1
a1.sinks = k1
a1.sinks.k1.type = null
a1.sinks.k1.channel = c1
a1:
  channels: c1
  sinks:
    k1:
      type: 'null'
      channel: c1
"a1": {
  "channels": "c1",
  "sinks": {
    "k1": {
      "type": "null",
      "channel": "c1"
    }
  }
}

Kafka Sink

This content is provided by the Flume Kafka module. See Kafka Sink in the Flume Kafka documentation.

HTTP Sink

This content is provided by the Flume HTTP module. See HTTP Sink in the Flume HTTP documentation.

Custom Sink

A custom sink is your own implementation of the Sink interface. A custom sink’s class and its dependencies must be included in the agent’s classpath when starting the Flume agent. The type of the custom sink is its FQCN. Required properties are in bold.

Property Name Default Description

channel

 — 

type

 — 

The component type name, needs to be your FQCN

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.channels = c1
a1.sinks = k1
a1.sinks.k1.type = org.example.MySink
a1.sinks.k1.channel = c1
a1:
  channels: c1
  sinks:
    k1:
      type: org.example.MySink
      channel: c1
"a1": {
  "channels": "c1",
  "sinks": {
    "k1": {
      "type": "org.example.MySink",
      "channel": "c1"
    }
  }
}

Flume Channels

Channels are the repositories where the events are staged on a agent. Source adds the events and Sink removes it.

Memory Channel

The events are stored in an in-memory queue with configurable max size. It’s ideal for flows that need higher throughput and are prepared to lose the staged data in the event of a agent failures. Required properties are in bold.

Property Name Default Description

type

 — 

The component type name, needs to be memory

capacity

100

The maximum number of events stored in the channel

transactionCapacity

100

The maximum number of events the channel will take from a source or give to a sink per transaction

keep-alive

3

Timeout in seconds for adding or removing an event

byteCapacityBufferPercentage

20

Defines the percent of buffer between byteCapacity and the estimated total size of all events in the channel, to account for data in headers. See below.

byteCapacity

see description

Maximum total bytes of memory allowed as a sum of all events in this channel. The implementation only counts the Event body, which is the reason for providing the byteCapacityBufferPercentage configuration parameter as well. Defaults to a computed value equal to 80% of the maximum memory available to the JVM (i.e. 80% of the -Xmx value passed on the command line). Note that if you have multiple memory channels on a single JVM, and they happen to hold the same physical events (i.e. if you are using a replicating channel selector from a single source) then those event sizes may be double-counted for channel byteCapacity purposes. Setting this value to 0 will cause this value to fall back to a hard internal limit of about 200 GB.

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.channels = c1
a1.channels.c1.type = memory
a1.channels.c1.capacity = 10000
a1.channels.c1.transactionCapacity = 10000
a1.channels.c1.byteCapacityBufferPercentage = 20
a1.channels.c1.byteCapacity = 800000
a1:
  channels:
    c1:
      type: memory
      capacity: 10000
      transactionCapacity: 10000
      byteCapacityBufferPercentage: 20
      byteCapacity: 800000
"a1": {
  "channels": {
    "c1": {
      "type": "memory",
      "capacity": 10000,
      "transactionCapacity": 10000,
      "byteCapacityBufferPercentage": 20,
      "byteCapacity": 800000
    }
  }
}

JDBC Channel

This content is provided by the Flume JDBC module. See JDBC Channel in the Flume JDBC documentation.

Kafka Channel

This content is provided by the Flume Kafka module. See Kafka Channel in the Flume Kafka documentation.

File Channel

Required properties are in bold.

Property Name Default Description

type

 — 

The component type name, needs to be file.

checkpointDir

~/.flume/file-channel/checkpoint

The directory where checkpoint file will be stored

useDualCheckpoints

false

Backup the checkpoint. If this is set to true, backupCheckpointDir must be set

backupCheckpointDir

 — 

The directory where the checkpoint is backed up to. This directory must not be the same as the data directories or the checkpoint directory

dataDirs

~/.flume/file-channel/data

Comma separated list of directories for storing log files. Using multiple directories on separate disks can improve file channel peformance

transactionCapacity

10000

The maximum size of transaction supported by the channel

checkpointInterval

30000

Amount of time (in millis) between checkpoints

maxFileSize

2146435071

Max size (in bytes) of a single log file

minimumRequiredSpace

524288000

Minimum Required free space (in bytes). To avoid data corruption, File Channel stops accepting take/put requests when free space drops below this value

capacity

1000000

Maximum capacity of the channel

keep-alive

3

Amount of time (in sec) to wait for a put operation

use-log-replay-v1

false

Expert: Use old replay logic

use-fast-replay

false

Expert: Replay without using queue

checkpointOnClose

true

Controls if a checkpoint is created when the channel is closed. Creating a checkpoint on close speeds up subsequent startup of the file channel by avoiding replay.

encryption.activeKey

 — 

Key name used to encrypt new data

encryption.cipherProvider

 — 

Cipher provider type, supported types: AESCTRNOPADDING

encryption.keyProvider

 — 

Key provider type, supported types: JCEKSFILE

encryption.keyProvider.keyStoreFile

 — 

Path to the keystore file

encrpytion.keyProvider.keyStorePasswordFile

 — 

Path to the keystore password file

encryption.keyProvider.keys

 — 

List of all keys (e.g. history of the activeKey setting)

encyption.keyProvider.keys.*.passwordFile

 — 

Path to the optional key password file

By default the File Channel uses paths for checkpoint and data directories that are within the user home as specified above. As a result if you have more than one File Channel instances active within the agent, only one will be able to lock the directories and cause the other channel initialization to fail. It is therefore necessary that you provide explicit paths to all the configured channels, preferably on different disks. Furthermore, as file channel will sync to disk after every commit, coupling it with a sink/source that batches events together may be necessary to provide good performance where multiple disks are not available for checkpoint and data directories.

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.channels = c1
a1.channels.c1.type = file
a1.channels.c1.checkpointDir = /mnt/flume/checkpoint
a1.channels.c1.dataDirs = /mnt/flume/data
a1:
  channels:
    c1:
      type: file
      checkpointDir: /mnt/flume/checkpoint
      dataDirs: /mnt/flume/data
"a1": {
  "channels": {
    "c1": {
      "type": "file",
      "checkpointDir": "/mnt/flume/checkpoint",
      "dataDirs": "/mnt/flume/data"
    }
  }
}

Encryption

Below is a few sample configurations:

Generating a key with a password seperate from the key store password:

keytool -genseckey -alias key-0 -keypass keyPassword -keyalg AES \
  -keysize 128 -validity 9000 -keystore test.keystore \
  -storetype jceks -storepass keyStorePassword

Generating a key with the password the same as the key store password:

keytool -genseckey -alias key-1 -keyalg AES -keysize 128 -validity 9000 \
  -keystore src/test/resources/test.keystore -storetype jceks \
  -storepass keyStorePassword
  • Properties

  • YAML

  • JSON

a1.channels.c1.encryption.activeKey = key-0
a1.channels.c1.encryption.cipherProvider = AESCTRNOPADDING
a1.channels.c1.encryption.keyProvider = JCEKSFILE
a1.channels.c1.encryption.keyProvider.keyStoreFile = /path/to/my.keystore
a1.channels.c1.encryption.keyProvider.keyStorePasswordFile = /path/to/my.keystore.password
a1.channels.c1.encryption.keyProvider.keys = key-0
a1:
  channels:
    c1:
      encryption:
        activeKey: key-0
        cipherProvider: AESCTRNOPADDING
        keyProvider: JCEKSFILE
        keyProvider.keyStoreFile: /path/to/my.keystore
        keyProvider.keyStorePasswordFile: /path/to/my.keystore.password
        keyProvider.keys: key-0
"a1": {
  "channels": {
    "c1": {
      "encryption": {
        "activeKey": "key-0",
        "cipherProvider": "AESCTRNOPADDING",
        "keyProvider": "JCEKSFILE",
        "keyProvider.keyStoreFile": "/path/to/my.keystore",
        "keyProvider.keyStorePasswordFile": "/path/to/my.keystore.password",
        "keyProvider.keys": "key-0"
      }
    }
  }
}

Let’s say you have aged key-0 out and new files should be encrypted with key-1:

  • Properties

  • YAML

  • JSON

a1.channels.c1.encryption.activeKey = key-1
a1.channels.c1.encryption.cipherProvider = AESCTRNOPADDING
a1.channels.c1.encryption.keyProvider = JCEKSFILE
a1.channels.c1.encryption.keyProvider.keyStoreFile = /path/to/my.keystore
a1.channels.c1.encryption.keyProvider.keyStorePasswordFile = /path/to/my.keystore.password
a1.channels.c1.encryption.keyProvider.keys = key-0 key-1
a1:
  channels:
    c1:
      encryption:
        activeKey: key-1
        cipherProvider: AESCTRNOPADDING
        keyProvider: JCEKSFILE
        keyProvider.keyStoreFile: /path/to/my.keystore
        keyProvider.keyStorePasswordFile: /path/to/my.keystore.password
        keyProvider.keys: key-0 key-1
"a1": {
  "channels": {
    "c1": {
      "encryption": {
        "activeKey": "key-1",
        "cipherProvider": "AESCTRNOPADDING",
        "keyProvider": "JCEKSFILE",
        "keyProvider.keyStoreFile": "/path/to/my.keystore",
        "keyProvider.keyStorePasswordFile": "/path/to/my.keystore.password",
        "keyProvider.keys": "key-0 key-1"
      }
    }
  }
}

The same scenerio as above, however key-0 has its own password:

  • Properties

  • YAML

  • JSON

a1.channels.c1.encryption.activeKey = key-1
a1.channels.c1.encryption.cipherProvider = AESCTRNOPADDING
a1.channels.c1.encryption.keyProvider = JCEKSFILE
a1.channels.c1.encryption.keyProvider.keyStoreFile = /path/to/my.keystore
a1.channels.c1.encryption.keyProvider.keyStorePasswordFile = /path/to/my.keystore.password
a1.channels.c1.encryption.keyProvider.keys = key-0 key-1
a1.channels.c1.encryption.keyProvider.keys.key-0.passwordFile = /path/to/key-0.password
a1:
  channels:
    c1:
      encryption:
        activeKey: key-1
        cipherProvider: AESCTRNOPADDING
        keyProvider: JCEKSFILE
        keyProvider.keyStoreFile: /path/to/my.keystore
        keyProvider.keyStorePasswordFile: /path/to/my.keystore.password
        keyProvider.keys: key-0 key-1
        keyProvider.keys.key-0:
          passwordFile: /path/to/key-0.password
"a1": {
  "channels": {
    "c1": {
      "encryption": {
        "activeKey": "key-1",
        "cipherProvider": "AESCTRNOPADDING",
        "keyProvider": "JCEKSFILE",
        "keyProvider.keyStoreFile": "/path/to/my.keystore",
        "keyProvider.keyStorePasswordFile": "/path/to/my.keystore.password",
        "keyProvider.keys": "key-0 key-1",
        "keyProvider.keys.key-0": {
          "passwordFile": "/path/to/key-0.password"
        }
      }
    }
  }
}

Spillable Memory Channel

The events are stored in an in-memory queue and on disk. The in-memory queue serves as the primary store and the disk as overflow. The disk store is managed using an embedded File channel. When the in-memory queue is full, additional incoming events are stored in the file channel. This channel is ideal for flows that need high throughput of memory channel during normal operation, but at the same time need the larger capacity of the file channel for better tolerance of intermittent sink side outages or drop in drain rates. The throughput will reduce approximately to file channel speeds during such abnormal situations. In case of an agent crash or restart, only the events stored on disk are recovered when the agent comes online. This channel is currently experimental and not recommended for use in production.

Required properties are in bold. Please refer to file channel for additional required properties.

Property Name Default Description

type

 — 

The component type name, needs to be SPILLABLEMEMORY

memoryCapacity

10000

Maximum number of events stored in memory queue. To disable use of in-memory queue, set this to zero.

overflowCapacity

100000000

Maximum number of events stored in overflow disk (i.e File channel). To disable use of overflow, set this to zero.

overflowTimeout

3

The number of seconds to wait before enabling disk overflow when memory fills up.

byteCapacityBufferPercentage

20

Defines the percent of buffer between byteCapacity and the estimated total size of all events in the channel, to account for data in headers. See below.

byteCapacity

see description

Maximum bytes of memory allowed as a sum of all events in the memory queue. The implementation only counts the Event body, which is the reason for providing the byteCapacityBufferPercentage configuration parameter as well. Defaults to a computed value equal to 80% of the maximum memory available to the JVM (i.e. 80% of the -Xmx value passed on the command line). Note that if you have multiple memory channels on a single JVM, and they happen to hold the same physical events (i.e. if you are using a replicating channel selector from a single source) then those event sizes may be double-counted for channel byteCapacity purposes. Setting this value to 0 will cause this value to fall back to a hard internal limit of about 200 GB.

avgEventSize

500

Estimated average size of events, in bytes, going into the channel

<file channel properties>

see file channel

Any file channel property with the exception of 'keep-alive' and 'capacity' can be used. The keep-alive of file channel is managed by Spillable Memory Channel. Use 'overflowCapacity' to set the File channel’s capacity.

In-memory queue is considered full if either memoryCapacity or byteCapacity limit is reached.

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.channels = c1
a1.channels.c1.type = SPILLABLEMEMORY
a1.channels.c1.memoryCapacity = 10000
a1.channels.c1.overflowCapacity = 1000000
a1.channels.c1.byteCapacity = 800000
a1.channels.c1.checkpointDir = /mnt/flume/checkpoint
a1.channels.c1.dataDirs = /mnt/flume/data
a1:
  channels:
    c1:
      type: SPILLABLEMEMORY
      memoryCapacity: 10000
      overflowCapacity: 1000000
      byteCapacity: 800000
      checkpointDir: /mnt/flume/checkpoint
      dataDirs: /mnt/flume/data
"a1": {
  "channels": {
    "c1": {
      "type": "SPILLABLEMEMORY",
      "memoryCapacity": 10000,
      "overflowCapacity": 1000000,
      "byteCapacity": 800000,
      "checkpointDir": "/mnt/flume/checkpoint",
      "dataDirs": "/mnt/flume/data"
    }
  }
}

To disable the use of the in-memory queue and function like a file channel:

  • Properties

  • YAML

  • JSON

a1.channels = c1
a1.channels.c1.type = SPILLABLEMEMORY
a1.channels.c1.memoryCapacity = 0
a1.channels.c1.overflowCapacity = 1000000
a1.channels.c1.checkpointDir = /mnt/flume/checkpoint
a1.channels.c1.dataDirs = /mnt/flume/data
a1:
  channels:
    c1:
      type: SPILLABLEMEMORY
      memoryCapacity: 0
      overflowCapacity: 1000000
      checkpointDir: /mnt/flume/checkpoint
      dataDirs: /mnt/flume/data
"a1": {
  "channels": {
    "c1": {
      "type": "SPILLABLEMEMORY",
      "memoryCapacity": 0,
      "overflowCapacity": 1000000,
      "checkpointDir": "/mnt/flume/checkpoint",
      "dataDirs": "/mnt/flume/data"
    }
  }
}

To disable the use of overflow disk and function purely as a in-memory channel:

  • Properties

  • YAML

  • JSON

a1.channels = c1
a1.channels.c1.type = SPILLABLEMEMORY
a1.channels.c1.memoryCapacity = 100000
a1.channels.c1.overflowCapacity = 0
a1:
  channels:
    c1:
      type: SPILLABLEMEMORY
      memoryCapacity: 100000
      overflowCapacity: 0
"a1": {
  "channels": {
    "c1": {
      "type": "SPILLABLEMEMORY",
      "memoryCapacity": 100000,
      "overflowCapacity": 0
    }
  }
}

Pseudo Transaction Channel

The Pseudo Transaction Channel is only for unit testing purposes and is NOT meant for production use.

Required properties are in bold.

Property Name Default Description

type

 — 

The component type name, needs to be org.apache.flume.channel.PseudoTxnMemoryChannel

capacity

50

The max number of events stored in the channel

keep-alive

3

Timeout in seconds for adding or removing an event

Custom Channel

A custom channel is your own implementation of the Channel interface. A custom channel’s class and its dependencies must be included in the agent’s classpath when starting the Flume agent. The type of the custom channel is its FQCN. Required properties are in bold.

Property Name Default Description

type

 — 

The component type name, needs to be a FQCN

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.channels = c1
a1.channels.c1.type = org.example.MyChannel
a1:
  channels:
    c1:
      type: org.example.MyChannel
"a1": {
  "channels": {
    "c1": {
      "type": "org.example.MyChannel"
    }
  }
}

Flume Channel Selectors

If the type is not specified, then defaults to "replicating".

Replicating Channel Selector (default)

Required properties are in bold.

Property Name Default Description

selector.type

replicating

The component type name, needs to be replicating

selector.optional

 — 

Set of channels to be marked as optional

Example for agent named a1 and it’s source called r1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1 c2 c3
a1.sources.r1.selector.type = replicating
a1.sources.r1.channels = c1 c2 c3
a1.sources.r1.selector.optional = c3
a1:
  sources:
    r1:
      selector:
        type: replicating
        optional: c3
      channels: c1 c2 c3
  channels: c1 c2 c3
"a1": {
  "sources": {
    "r1": {
      "selector": {
        "type": "replicating",
        "optional": "c3"
      },
      "channels": "c1 c2 c3"
    }
  },
  "channels": "c1 c2 c3"
}

In the above configuration, c3 is an optional channel. Failure to write to c3 is simply ignored. Since c1 and c2 are not marked optional, failure to write to those channels will cause the transaction to fail.

Load Balancing Channel Selector

Load balancing channel selector provides the ability to load-balance flow over multiple channels. This effectively allows the incoming data to be processed on multiple threads. It maintains an indexed list of active channels on which the load must be distributed. Implementation supports distributing load using either via round_robin or random selection mechanisms. The choice of selection mechanism defaults to round_robin type, but can be overridden via configuration.

Required properties are in bold.

Property Name Default Description

selector.type

replicating

The component type name, needs to be load_balancing

selector.policy

round_robin

Selection mechanism. Must be either round_robin or random.

Example for agent named a1 and it’s source called r1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1 c2 c3 c4
a1.sources.r1.channels = c1 c2 c3 c4
a1.sources.r1.selector.type = load_balancing
a1.sources.r1.selector.policy = round_robin
a1:
  sources:
    r1:
      channels: c1 c2 c3 c4
      selector:
        type: load_balancing
        policy: round_robin
  channels: c1 c2 c3 c4
"a1": {
  "sources": {
    "r1": {
      "channels": "c1 c2 c3 c4",
      "selector": {
        "type": "load_balancing",
        "policy": "round_robin"
      }
    }
  },
  "channels": "c1 c2 c3 c4"
}

Multiplexing Channel Selector

Required properties are in bold.

Property Name Default Description

selector.type

replicating

The component type name, needs to be multiplexing

selector.header

flume.selector.header

selector.default

 — 

selector.mapping.*

 — 

Example for agent named a1 and it’s source called r1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1 c2 c3 c4
a1.sources.r1.selector.type = multiplexing
a1.sources.r1.selector.header = state
a1.sources.r1.selector.mapping.CZ = c1
a1.sources.r1.selector.mapping.US = c2 c3
a1.sources.r1.selector.default = c4
a1:
  sources:
    r1:
      selector:
        type: multiplexing
        header: state
        mapping:
          CZ: c1
          US: c2 c3
        default: c4
  channels: c1 c2 c3 c4
"a1": {
  "sources": {
    "r1": {
      "selector": {
        "type": "multiplexing",
        "header": "state",
        "mapping": {
          "CZ": "c1",
          "US": "c2 c3"
        },
        "default": "c4"
      }
    }
  },
  "channels": "c1 c2 c3 c4"
}

Routable Proxy Channel Selector

The routable proxy channel selector does not choose channels itself. Instead it delegates to one of several nested channel selectors, choosing the nested selector by the value of an event header. This makes it possible, for example, to load balance most events across one group of channels while sending events that need special handling to a different group of channels, each group using whatever selection strategy suits it.

Each nested selector is identified by the header value it handles. When an event arrives, the selector looks up the value of the header named by selector.headerName and uses the nested selector configured for that value. Header values are matched exactly, including case. If the header is missing, or its value has no nested selector, the nested selector named default is used. If there is no default selector either, the event is not routed to any channel.

Every nested selector is configured with properties of the form selector.<headerValue>.selector.<property>. The channels property is required and lists the channels, separated by whitespace, that the nested selector may choose from. These channels must also be configured as channels of the source. The type property selects the kind of nested selector (replicating, multiplexing, load_balancing or a fully qualified class name) and defaults to replicating. Any other properties are passed on to the nested selector, so a load_balancing selector can be given a policy.

Required properties are in bold.

Property Name Default Description

selector.type

replicating

The component type name, needs to be routable_proxy

selector.headerName

 — 

Name of the event header whose value selects the nested channel selector

selector.default.selector.channels

 — 

Channels used by the nested selector that handles events whose header is missing or has no matching nested selector

selector.default.selector.type

replicating

Type of the default nested selector

selector.<headerValue>.selector.channels

 — 

Channels used by the nested selector that handles events whose header equals <headerValue>. Required for each nested selector that is configured.

selector.<headerValue>.selector.type

replicating

Type of the nested selector for <headerValue>

selector.<headerValue>.selector.*

 — 

Any other properties of the nested selector, such as policy for a load_balancing selector

The following example routes events based on the value of the processingMode header. Events whose processingMode header is Validation are sent to the validation channel c3. All other events, including events without the header, are load balanced across the primary channels c1 and c2 in round robin order.

Example for agent named a1 and its source called r1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1 c2 c3
a1.sources.r1.channels = c1 c2 c3
a1.sources.r1.selector.type = routable_proxy
a1.sources.r1.selector.headerName = processingMode
a1.sources.r1.selector.default.selector.type = load_balancing
a1.sources.r1.selector.default.selector.channels = c1 c2
a1.sources.r1.selector.default.selector.policy = round_robin
a1.sources.r1.selector.Validation.selector.type = replicating
a1.sources.r1.selector.Validation.selector.channels = c3
a1:
  sources:
    r1:
      channels: c1 c2 c3
      selector:
        type: routable_proxy
        headerName: processingMode
        default:
          selector:
            type: load_balancing
            channels: c1 c2
            policy: round_robin
        Validation:
          selector:
            type: replicating
            channels: c3
  channels: c1 c2 c3
"a1": {
  "sources": {
    "r1": {
      "channels": "c1 c2 c3",
      "selector": {
        "type": "routable_proxy",
        "headerName": "processingMode",
        "default": {
          "selector": {
            "type": "load_balancing",
            "channels": "c1 c2",
            "policy": "round_robin"
          }
        },
        "Validation": {
          "selector": {
            "type": "replicating",
            "channels": "c3"
          }
        }
      }
    }
  },
  "channels": "c1 c2 c3"
}

The order of the channels in a nested selector’s channels list is not preserved, so a load_balancing nested selector with the round_robin policy cycles through its channels in an unspecified order. Channel names that are not channels of the source are ignored.

Custom Channel Selector

A custom channel selector is your own implementation of the ChannelSelector interface. A custom channel selector’s class and its dependencies must be included in the agent’s classpath when starting the Flume agent. The type of the custom channel selector is its FQCN.

Property Name Default Description

selector.type

 — 

The component type name, needs to be your FQCN

Example for agent named a1 and its source called r1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.sources.r1.selector.type = org.example.MyChannelSelector
a1:
  sources:
    r1:
      selector:
        type: org.example.MyChannelSelector
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "selector": {
        "type": "org.example.MyChannelSelector"
      }
    }
  },
  "channels": "c1"
}

Flume Sink Processors

Sink groups allow users to group multiple sinks into one entity. Sink processors can be used to provide load balancing capabilities over all sinks inside the group or to achieve fail over from one sink to another in case of temporal failure.

Required properties are in bold.

Property Name Default Description

sinks

 — 

Space-separated list of sinks that are participating in the group

processor.type

default

The component type name, needs to be default, failover or load_balance

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sinkgroups = g1
a1.sinkgroups.g1.sinks = k1 k2
a1.sinkgroups.g1.processor.type = load_balance
a1:
  sinkgroups:
    g1:
      sinks: k1 k2
      processor:
        type: load_balance
"a1": {
  "sinkgroups": {
    "g1": {
      "sinks": "k1 k2",
      "processor": {
        "type": "load_balance"
      }
    }
  }
}

Default Sink Processor

Default sink processor accepts only a single sink. User is not forced to create processor (sink group) for single sinks. Instead user can follow the source - channel - sink pattern that was explained above in this user guide.

Failover Sink Processor

Failover Sink Processor maintains a prioritized list of sinks, guaranteeing that so long as one is available events will be processed (delivered).

The failover mechanism works by relegating failed sinks to a pool where they are assigned a cool down period, increasing with sequential failures before they are retried. Once a sink successfully sends an event, it is restored to the live pool. The Sinks have a priority associated with them, larger the number, higher the priority. If a Sink fails while sending a Event the next Sink with highest priority shall be tried next for sending Events. For example, a sink with priority 100 is activated before the Sink with priority 80. If no priority is specified, thr priority is determined based on the order in which the Sinks are specified in configuration.

To configure, set a sink groups processor to failover and set priorities for all individual sinks. All specified priorities must be unique. Furthermore, upper limit to failover time can be set (in milliseconds) using maxpenalty property.

Required properties are in bold.

Property Name Default Description

sinks

 — 

Space-separated list of sinks that are participating in the group

processor.type

default

The component type name, needs to be failover

processor.priority.<sinkName>

 — 

Priority value. <sinkName> must be one of the sink instances associated with the current sink group A higher priority value Sink gets activated earlier. A larger absolute value indicates higher priority

processor.maxpenalty

30000

The maximum backoff period for the failed Sink (in millis)

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sinkgroups = g1
a1.sinkgroups.g1.sinks = k1 k2
a1.sinkgroups.g1.processor.type = failover
a1.sinkgroups.g1.processor.priority.k1 = 5
a1.sinkgroups.g1.processor.priority.k2 = 10
a1.sinkgroups.g1.processor.maxpenalty = 10000
a1:
  sinkgroups:
    g1:
      sinks: k1 k2
      processor:
        type: failover
        priority:
          k1: 5
          k2: 10
        maxpenalty: 10000
"a1": {
  "sinkgroups": {
    "g1": {
      "sinks": "k1 k2",
      "processor": {
        "type": "failover",
        "priority": {
          "k1": 5,
          "k2": 10
        },
        "maxpenalty": 10000
      }
    }
  }
}

Load balancing Sink Processor

Load balancing sink processor provides the ability to load-balance flow over multiple sinks. It maintains an indexed list of active sinks on which the load must be distributed. Implementation supports distributing load using either via round_robin or random selection mechanisms. The choice of selection mechanism defaults to round_robin type, but can be overridden via configuration. Custom selection mechanisms are supported via custom classes that inherits from AbstractSinkSelector.

When invoked, this selector picks the next sink using its configured selection mechanism and invokes it. For round_robin and random In case the selected sink fails to deliver the event, the processor picks the next available sink via its configured selection mechanism. This implementation does not blacklist the failing sink and instead continues to optimistically attempt every available sink. If all sinks invocations result in failure, the selector propagates the failure to the sink runner.

If backoff is enabled, the sink processor will blacklist sinks that fail, removing them for selection for a given timeout. When the timeout ends, if the sink is still unresponsive timeout is increased exponentially to avoid potentially getting stuck in long waits on unresponsive sinks. With this disabled, in round-robin all the failed sinks load will be passed to the next sink in line and thus not evenly balanced

Required properties are in bold.

Property Name Default Description

processor.sinks

 — 

Space-separated list of sinks that are participating in the group

processor.type

default

The component type name, needs to be load_balance

processor.backoff

false

Should failed sinks be backed off exponentially.

processor.selector

round_robin

Selection mechanism. Must be either round_robin, random or FQCN of custom class that inherits from AbstractSinkSelector

processor.selector.maxTimeOut

30000

Used by backoff selectors to limit exponential backoff (in milliseconds)

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sinkgroups = g1
a1.sinkgroups.g1.sinks = k1 k2
a1.sinkgroups.g1.processor.type = load_balance
a1.sinkgroups.g1.processor.backoff = true
a1.sinkgroups.g1.processor.selector = random
a1:
  sinkgroups:
    g1:
      sinks: k1 k2
      processor:
        type: load_balance
        backoff: true
        selector: random
"a1": {
  "sinkgroups": {
    "g1": {
      "sinks": "k1 k2",
      "processor": {
        "type": "load_balance",
        "backoff": true,
        "selector": "random"
      }
    }
  }
}

Custom Sink Processor

Custom sink processors are not supported at the moment.

Event Serializers

The file_roll sink and the hdfs sink both support the EventSerializer interface. Details of the EventSerializers that ship with Flume are provided below.

Body Text Serializer

Alias: text. This interceptor writes the body of the event to an output stream without any transformation or modification. The event headers are ignored. Configuration options are as follows:

Property Name Default Description

appendNewline

true

Whether a newline will be appended to each event at write time. The default of true assumes that events do not contain newlines, for legacy reasons.

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sinks = k1
a1.sinks.k1.type = file_roll
a1.sinks.k1.channel = c1
a1.sinks.k1.sink.directory = /var/log/flume
a1.sinks.k1.sink.serializer = text
a1.sinks.k1.sink.serializer.appendNewline = false
a1:
  sinks:
    k1:
      type: file_roll
      channel: c1
      sink:
        directory: /var/log/flume
        serializer: text
        serializer.appendNewline: false
"a1": {
  "sinks": {
    "k1": {
      "type": "file_roll",
      "channel": "c1",
      "sink": {
        "directory": "/var/log/flume",
        "serializer": "text",
        "serializer.appendNewline": false
      }
    }
  }
}

"Flume Event" Avro Event Serializer

This content is provided by the Flume RPC module. See "Flume Event" Avro Event Serializer in the Flume RPC documentation.

Avro Event Serializer

Alias: This serializer does not have an alias, and must be specified using the fully-qualified class name class name.

This serializes Flume events into an Avro container file like the "Flume Event" Avro Event Serializer, however the record schema is configurable. The record schema may be specified either as a Flume configuration property or passed in an event header.

To pass the record schema as part of the Flume configuration, use the property schemaURL as listed below.

To pass the record schema in an event header, specify either the event header flume.avro.schema.literal containing a JSON-format representation of the schema or flume.avro.schema.url with a URL where the schema may be found (hdfs:/…​ URIs are supported).

This serializer inherits from the AbstractAvroEventSerializer class.

Configuration options are as follows:

Property Name Default Description

syncIntervalBytes

2048000

Avro sync interval, in approximate bytes.

compressionCodec

null

Avro compression codec. For supported codecs, see Avro’s CodecFactory docs.

schemaURL

null

Avro schema URL. Schemas specified in the header ovverride this option.

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sinks.k1.type = hdfs
a1.sinks.k1.channel = c1
a1.sinks.k1.hdfs.path = /flume/events/%y-%m-%d/%H%M/%S
a1.sinks.k1.serializer = org.apache.flume.sink.hdfs.AvroEventSerializer$Builder
a1.sinks.k1.serializer.compressionCodec = snappy
a1.sinks.k1.serializer.schemaURL = hdfs://namenode/path/to/schema.avsc
a1:
  sinks:
    k1:
      type: hdfs
      channel: c1
      hdfs:
        path: /flume/events/%y-%m-%d/%H%M/%S
      serializer: org.apache.flume.sink.hdfs.AvroEventSerializer$Builder
      serializer.compressionCodec: snappy
      serializer.schemaURL: hdfs://namenode/path/to/schema.avsc
"a1": {
  "sinks": {
    "k1": {
      "type": "hdfs",
      "channel": "c1",
      "hdfs": {
        "path": "/flume/events/%y-%m-%d/%H%M/%S"
      },
      "serializer": "org.apache.flume.sink.hdfs.AvroEventSerializer$Builder",
      "serializer.compressionCodec": "snappy",
      "serializer.schemaURL": "hdfs://namenode/path/to/schema.avsc"
    }
  }
}

Flume Interceptors

Flume has the capability to modify/drop events in-flight. This is done with the help of interceptors. Interceptors are classes that implement org.apache.flume.interceptor.Interceptor interface. An interceptor can modify or even drop events based on any criteria chosen by the developer of the interceptor. Flume supports chaining of interceptors. This is made possible through by specifying the list of interceptor builder class names in the configuration. Interceptors are specified as a whitespace separated list in the source configuration. The order in which the interceptors are specified is the order in which they are invoked. The list of events returned by one interceptor is passed to the next interceptor in the chain. Interceptors can modify or drop events. If an interceptor needs to drop events, it just does not return that event in the list that it returns. If it is to drop all events, then it simply returns an empty list. Interceptors are named components, here is an example of how they are created through configuration:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.sinks = k1
a1.channels = c1
a1.sources.r1.interceptors = i1 i2
a1.sources.r1.interceptors.i1.type = org.apache.flume.interceptor.HostInterceptor$Builder
a1.sources.r1.interceptors.i1.preserveExisting = false
a1.sources.r1.interceptors.i1.hostHeader = hostname
a1.sources.r1.interceptors.i2.type = org.apache.flume.interceptor.TimestampInterceptor$Builder
a1.sinks.k1.filePrefix = FlumeData.%{CollectorHost}.%Y-%m-%d
a1.sinks.k1.channel = c1
a1:
  sources:
    r1:
      interceptors:
        i1:
          type: org.apache.flume.interceptor.HostInterceptor$Builder
          preserveExisting: false
          hostHeader: hostname
        i2:
          type: org.apache.flume.interceptor.TimestampInterceptor$Builder
  sinks:
    k1:
      filePrefix: FlumeData.%{CollectorHost}.%Y-%m-%d
      channel: c1
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "interceptors": {
        "i1": {
          "type": "org.apache.flume.interceptor.HostInterceptor$Builder",
          "preserveExisting": false,
          "hostHeader": "hostname"
        },
        "i2": {
          "type": "org.apache.flume.interceptor.TimestampInterceptor$Builder"
        }
      }
    }
  },
  "sinks": {
    "k1": {
      "filePrefix": "FlumeData.%{CollectorHost}.%Y-%m-%d",
      "channel": "c1"
    }
  },
  "channels": "c1"
}

Note that the interceptor builders are passed to the type config parameter. The interceptors are themselves configurable and can be passed configuration values just like they are passed to any other configurable component. In the above example, events are passed to the HostInterceptor first and the events returned by the HostInterceptor are then passed along to the TimestampInterceptor. You can specify either the fully qualified class name (FQCN) or the alias timestamp. If you have multiple collectors writing to the same HDFS path, then you could also use the HostInterceptor.

Timestamp Interceptor

This interceptor inserts into the event headers, the time in millis at which it processes the event. This interceptor inserts a header with key timestamp (or as specified by the header property) whose value is the relevant timestamp. This interceptor can preserve an existing timestamp if it is already present in the configuration.

Property Name Default Description

type

 — 

The component type name, has to be timestamp or the FQCN

headerName

timestamp

The name of the header in which to place the generated timestamp.

preserveExisting

false

If the timestamp already exists, should it be preserved - true or false

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.sources.r1.channels =  c1
a1.sources.r1.type = seq
a1.sources.r1.interceptors = i1
a1.sources.r1.interceptors.i1.type = timestamp
a1:
  sources:
    r1:
      channels: ' c1'
      type: seq
      interceptors:
        i1:
          type: timestamp
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "channels": " c1",
      "type": "seq",
      "interceptors": {
        "i1": {
          "type": "timestamp"
        }
      }
    }
  },
  "channels": "c1"
}

Host Interceptor

This interceptor inserts the hostname or IP address of the host that this agent is running on. It inserts a header with key host or a configured key whose value is the hostname or IP address of the host, based on configuration.

Property Name Default Description

type

 — 

The component type name, has to be host

preserveExisting

false

If the host header already exists, should it be preserved - true or false

useIP

true

Use the IP Address if true, else use hostname.

hostHeader

host

The header key to be used.

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.sources.r1.interceptors = i1
a1.sources.r1.interceptors.i1.type = host
a1:
  sources:
    r1:
      interceptors:
        i1:
          type: host
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "interceptors": {
        "i1": {
          "type": "host"
        }
      }
    }
  },
  "channels": "c1"
}

Static Interceptor

Static interceptor allows user to append a static header with static value to all events.

The current implementation does not allow specifying multiple headers at one time. Instead user might chain multiple static interceptors each defining one static header.

Property Name Default Description

type

 — 

The component type name, has to be static

preserveExisting

true

If configured header already exists, should it be preserved - true or false

key

key

Name of header that should be created

value

value

Static value that should be created

Example for agent named a1:

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.sources.r1.channels =  c1
a1.sources.r1.type = seq
a1.sources.r1.interceptors = i1
a1.sources.r1.interceptors.i1.type = static
a1.sources.r1.interceptors.i1.key = datacenter
a1.sources.r1.interceptors.i1.value = NEW_YORK
a1:
  sources:
    r1:
      channels: ' c1'
      type: seq
      interceptors:
        i1:
          type: static
          key: datacenter
          value: NEW_YORK
  channels: c1
"a1": {
  "sources": {
    "r1": {
      "channels": " c1",
      "type": "seq",
      "interceptors": {
        "i1": {
          "type": "static",
          "key": "datacenter",
          "value": "NEW_YORK"
        }
      }
    }
  },
  "channels": "c1"
}

Remove Header Interceptor

This interceptor manipulates Flume event headers, by removing one or many headers. It can remove a statically defined header, headers based on a regular expression or headers in a list. If none of these is defined, or if no header matches the criteria, the Flume events are not modified.

Note that if only one header needs to be removed, specifying it by name provides performance benefits over the other 2 methods.

Property Name Default Description

type

 — 

The component type name has to be remove_header

withName

 — 

Name of the header to remove

fromList

 — 

List of headers to remove, separated with the separator specified by fromListSeparator

fromListSeparator

\s*,\s*

Regular expression used to separate multiple header names in the list specified by fromList. Default is a comma surrounded by any number of whitespace characters

matching

 — 

All the headers which names match this regular expression are removed

UUID Interceptor

This interceptor sets a universally unique identifier on all events that are intercepted. An example UUID is b5755073-77a9-43c1-8fad-b7a586fc1b97, which represents a 128-bit value.

Consider using UUIDInterceptor to automatically assign a UUID to an event if no application level unique key for the event is available. It can be important to assign UUIDs to events as soon as they enter the Flume network; that is, in the first Flume Source of the flow. This enables subsequent deduplication of events in the face of replication and redelivery in a Flume network that is designed for high availability and high performance. If an application level key is available, this is preferable over an auto-generated UUID because it enables subsequent updates and deletes of event in data stores using said well known application level key.

Property Name Default Description

type

 — 

The component type name has to be org.apache.flume.sink.solr.morphline.UUIDInterceptor$Builder

headerName

id

The name of the Flume header to modify

preserveExisting

true

If the UUID header already exists, should it be preserved - true or false

prefix

""

The prefix string constant to prepend to each generated UUID

Search and Replace Interceptor

This interceptor provides simple string-based search-and-replace functionality based on Java regular expressions. Backtracking / group capture is also available. This interceptor uses the same rules as in the Java Matcher.replaceAll() method.

Property Name Default Description

type

 — 

The component type name has to be search_replace

searchPattern

 — 

The pattern to search for and replace.

replaceString

 — 

The replacement string.

charset

UTF-8

The charset of the event body. Assumed by default to be UTF-8.

Example configuration:

  • Properties

  • YAML

  • JSON

a1.sources.avroSrc.interceptors = search-replace
a1.sources.avroSrc.interceptors.search-replace.type = search_replace

# Remove leading alphanumeric characters in an event body.
a1.sources.avroSrc.interceptors.search-replace.searchPattern = ^[A-Za-z0-9_]+
a1.sources.avroSrc.interceptors.search-replace.replaceString =
a1:
  sources:
    avroSrc:
      interceptors:
        search-replace:
          type: search_replace
          # Remove leading alphanumeric characters in an event body.
          searchPattern: ^[A-Za-z0-9_]+
          replaceString: ''
"a1": {
  "sources": {
    "avroSrc": {
      "interceptors": {
        "search-replace": {
          "type": "search_replace",
          "searchPattern": "^[A-Za-z0-9_]+",
          "replaceString": ""
        }
      }
    }
  }
}

Another example:

  • Properties

  • YAML

  • JSON

a1.sources.avroSrc.interceptors = search-replace
a1.sources.avroSrc.interceptors.search-replace.type = search_replace

# Use grouping operators to reorder and munge words on a line.
a1.sources.avroSrc.interceptors.search-replace.searchPattern = The quick brown ([a-z]+) jumped over the lazy ([a-z]+)
a1.sources.avroSrc.interceptors.search-replace.replaceString = The hungry $2 ate the careless $1
a1:
  sources:
    avroSrc:
      interceptors:
        search-replace:
          type: search_replace
          # Use grouping operators to reorder and munge words on a line.
          searchPattern: The quick brown ([a-z]+) jumped over the lazy ([a-z]+)
          replaceString: The hungry $2 ate the careless $1
"a1": {
  "sources": {
    "avroSrc": {
      "interceptors": {
        "search-replace": {
          "type": "search_replace",
          "searchPattern": "The quick brown ([a-z]+) jumped over the lazy ([a-z]+)",
          "replaceString": "The hungry $2 ate the careless $1"
        }
      }
    }
  }
}

Regex Filtering Interceptor

This interceptor filters events selectively by interpreting the event body as text and matching the text against a configured regular expression. The supplied regular expression can be used to include events or exclude events.

Property Name Default Description

type

 — 

The component type name has to be regex_filter

regex

".*"

Regular expression for matching against events

excludeEvents

false

If true, regex determines events to exclude, otherwise regex determines events to include.

Regex Extractor Interceptor

This interceptor extracts regex match groups using a specified regular expression and appends the match groups as headers on the event. It also supports pluggable serializers for formatting the match groups before adding them as event headers.

Property Name Default Description

type

 — 

The component type name has to be regex_extractor

regex

 — 

Regular expression for matching against events

serializers

 — 

Space-separated list of serializers for mapping matches to header names and serializing their values. (See example below) Flume provides built-in support for the following serializers: org.apache.flume.interceptor.RegexExtractorInterceptorPassThroughSerializer org.apache.flume.interceptor.RegexExtractorInterceptorMillisSerializer

serializers.<s1>.type

default

Must be default (org.apache.flume.interceptor.RegexExtractorInterceptorPassThroughSerializer), org.apache.flume.interceptor.RegexExtractorInterceptorMillisSerializer, or the FQCN of a custom class that implements org.apache.flume.interceptor.RegexExtractorInterceptorSerializer

serializers.<s1>.name

 — 

serializers.*

 — 

Serializer-specific properties

The serializers are used to map the matches to a header name and a formatted header value; by default, you only need to specify the header name and the default org.apache.flume.interceptor.RegexExtractorInterceptorPassThroughSerializer will be used. This serializer simply maps the matches to the specified header name and passes the value through as it was extracted by the regex. You can plug custom serializer implementations into the extractor using the fully qualified class name (FQCN) to format the matches in anyway you like.

Example 1:

If the Flume event body contained 1:2:3.4foobar5 and the following configuration was used

  • Properties

  • YAML

  • JSON

a1.sources.r1.interceptors.i1.regex = (\\d):(\\d):(\\d)
a1.sources.r1.interceptors.i1.serializers = s1 s2 s3
a1.sources.r1.interceptors.i1.serializers.s1.name = one
a1.sources.r1.interceptors.i1.serializers.s2.name = two
a1.sources.r1.interceptors.i1.serializers.s3.name = three
a1:
  sources:
    r1:
      interceptors:
        i1:
          regex: '(\d):(\d):(\d)'
          serializers:
            s1:
              name: one
            s2:
              name: two
            s3:
              name: three
"a1": {
  "sources": {
    "r1": {
      "interceptors": {
        "i1": {
          "regex": "(\\d):(\\d):(\\d)",
          "serializers": {
            "s1": {
              "name": "one"
            },
            "s2": {
              "name": "two"
            },
            "s3": {
              "name": "three"
            }
          }
        }
      }
    }
  }
}

The extracted event will contain the same body but the following headers will have been added one=>1, two=>2, three=>3

Example 2:

If the Flume event body contained 2012-10-18 18:47:57,614 some log line and the following configuration was used

  • Properties

  • YAML

  • JSON

a1.sources.r1.interceptors.i1.regex = ^(?:\\n)?(\\d\\d\\d\\d-\\d\\d-\\d\\d\\s\\d\\d:\\d\\d)
a1.sources.r1.interceptors.i1.serializers = s1
a1.sources.r1.interceptors.i1.serializers.s1.type = org.apache.flume.interceptor.RegexExtractorInterceptorMillisSerializer
a1.sources.r1.interceptors.i1.serializers.s1.name = timestamp
a1.sources.r1.interceptors.i1.serializers.s1.pattern = yyyy-MM-dd HH:mm
a1:
  sources:
    r1:
      interceptors:
        i1:
          regex: '^(?:\n)?(\d\d\d\d-\d\d-\d\d\s\d\d:\d\d)'
          serializers:
            s1:
              type: org.apache.flume.interceptor.RegexExtractorInterceptorMillisSerializer
              name: timestamp
              pattern: yyyy-MM-dd HH:mm
"a1": {
  "sources": {
    "r1": {
      "interceptors": {
        "i1": {
          "regex": "^(?:\\n)?(\\d\\d\\d\\d-\\d\\d-\\d\\d\\s\\d\\d:\\d\\d)",
          "serializers": {
            "s1": {
              "type": "org.apache.flume.interceptor.RegexExtractorInterceptorMillisSerializer",
              "name": "timestamp",
              "pattern": "yyyy-MM-dd HH:mm"
            }
          }
        }
      }
    }
  }
}

the extracted event will contain the same body but the following headers will have been added timestamp=>1350611220000

Flume Properties

Property Name Default Description

flume.called.from.service

 — 

If this property is specified then the Flume agent will continue polling for the config file even if the config file is not found at the expected location. Otherwise, the Flume agent will terminate if the config doesn’t exist at the expected location. No property value is needed when setting this property (eg, just specifying -Dflume.called.from.service is enough)

Property: flume.called.from.service

Flume periodically polls, every 30 seconds, for changes to the specified config file. A Flume agent loads a new configuration from the config file if either an existing file is polled for the first time, or if an existing file’s modification date has changed since the last time it was polled. Renaming or moving a file does not change its modification time. When a Flume agent polls a non-existent file then one of two things happens:

  1. When the agent polls a non-existent config file for the first time, then the agent behaves according to the flume.called.from.service property. If the property is set, then the agent will continue polling (always at the same period — every 30 seconds). If the property is not set, then the agent immediately terminates. …​OR…​

  2. When the agent polls a non-existent config file and this is not the first time the file is polled, then the agent makes no config changes for this polling period. The agent continues polling rather than terminating.

Configuration Filters

Configuration Filters do not apply to Spring Boot configurations. Use standard Spring support when configuring via Spring Boot.

Flume provides a tool for injecting sensitive or generated data into the configuration in the form of configuration filters. A configuration key can be set as the value of configuration properties and it will be replaced by the configuration filter with the value it represents.

Common usage of config filters

The format is similar to the Java Expression Language, however it is currently not a fully working EL expression parser, just a format that looks like it.

  • Properties

  • YAML

  • JSON

agent_name.configfilters = filter_name
agent_name.configfilters.filter_name.type = filter_type

agent_name.sources.source_name.parameter = ${filter_name['key_for_sensitive_or_generated_data']}
agent_name.sinks.sink_name.parameter = ${filter_name['key_for_sensitive_or_generated_data']}
agent_name.component_type.component_name.parameter = ${filter_name['key_for_sensitive_or_generated_data']}
# or
agent_name.component_type.component_name.parameter = ${filter_name["key_for_sensitive_or_generated_data"]}
# or
agent_name.component_type.component_name.parameter = ${filter_name[key_for_sensitive_or_generated_data]}
# or
agent_name.component_type.component_name.parameter = some_constant_data${filter_name[key_for_sensitive_or_generated_data]}
agent_name:
  configfilters:
    filter_name:
      type: filter_type
  sources:
    source_name:
      parameter: "${filter_name['key_for_sensitive_or_generated_data']}"
  sinks:
    sink_name:
      parameter: "${filter_name['key_for_sensitive_or_generated_data']}"
  component_type:
    component_name:
      parameter: "${filter_name['key_for_sensitive_or_generated_data']}"
      # or
      # parameter: "${filter_name[key_for_sensitive_or_generated_data]}"
      # or
      # parameter: "some_constant_data${filter_name[key_for_sensitive_or_generated_data]}"
"agent_name": {
  "configfilters": {
    "filter_name": {
      "type": "filter_type"
    }
  },
  "sources": {
    "source_name": {
      "parameter": "${filter_name['key_for_sensitive_or_generated_data']}"
    }
  },
  "sinks": {
    "sink_name": {
      "parameter": "${filter_name['key_for_sensitive_or_generated_data']}"
    }
  },
  "component_type": {
    "component_name": {
      "parameter": "${filter_name['key_for_sensitive_or_generated_data']}"
    }
  }
}

Environment Variable Config Filter

Property Name Default Description

type

 — 

The component type name has to be env

Example

To hide a password in the configuration set its value as in the following example.

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.configfilters = f1

a1.configfilters.f1.type = env

a1.sources.r1.channels =  c1
a1.sources.r1.type = thrift
a1.sources.r1.keystorePassword = ${f1['my_keystore_password']} #will get the value Secret123
a1:
  sources:
    r1:
      channels: ' c1'
      type: thrift
      keystorePassword: "${f1['my_keystore_password']} #will get the value Secret123"
  channels: c1
  configfilters:
    f1:
      type: env
"a1": {
  "sources": {
    "r1": {
      "channels": " c1",
      "type": "thrift",
      "keystorePassword": "${f1['my_keystore_password']} #will get the value Secret123"
    }
  },
  "channels": "c1",
  "configfilters": {
    "f1": {
      "type": "env"
    }
  }
}

Here the a1.sources.r1.keystorePassword configuration property will get the value of the my_keystore_password environment variable. One way to set the environment variable is to run flume agent like this:

$ my_keystore_password=Secret123 bin/flume-ng agent --conf conf --conf-file example.conf …​

External Process Config Filter

Property Name Default Description

type

 — 

The component type name has to be external

command

 — 

The command that will be executed to get the value for the given key. The command will be called like: <command> <key> And expected to return a single line value with exit code 0.

charset

UTF-8

The characterset of the returned string.

Example

To hide a password in the configuration set its value as in the following example.

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.configfilters = f1

a1.configfilters.f1.type = external
a1.configfilters.f1.command = /usr/bin/passwordResolver.sh
a1.configfilters.f1.charset = UTF-8

a1.sources.r1.channels =  c1
a1.sources.r1.type = thrift
a1.sources.r1.keystorePassword = ${f1['my_keystore_password']} #will get the value Secret123
a1:
  sources:
    r1:
      channels: ' c1'
      type: thrift
      keystorePassword: "${f1['my_keystore_password']} #will get the value Secret123"
  channels: c1
  configfilters:
    f1:
      type: external
      command: /usr/bin/passwordResolver.sh
      charset: UTF-8
"a1": {
  "sources": {
    "r1": {
      "channels": " c1",
      "type": "thrift",
      "keystorePassword": "${f1['my_keystore_password']} #will get the value Secret123"
    }
  },
  "channels": "c1",
  "configfilters": {
    "f1": {
      "type": "external",
      "command": "/usr/bin/passwordResolver.sh",
      "charset": "UTF-8"
    }
  }
}

In this example flume will run the following command to get the value

$ /usr/bin/passwordResolver.sh my_keystore_password

The passwordResolver.sh will return Secret123 with an exit code 0.

Example 2

To generate a part of the directory for rolling file sink set its value as in the following example.

  • Properties

  • YAML

  • JSON

a1.sources = r1
a1.channels = c1
a1.configfilters = f1

a1.configfilters.f1.type = external
a1.configfilters.f1.command = /usr/bin/generateUniqId.sh
a1.configfilters.f1.charset = UTF-8

a1.sinks = k1
a1.sinks.k1.type = file_roll
a1.sinks.k1.channel = c1
a1.sinks.k1.sink.directory = /var/log/flume/agent_${f1['agent_name']} # will be /var/log/flume/agent_1234
a1:
  sources: r1
  channels: c1
  configfilters:
    f1:
      type: external
      command: /usr/bin/generateUniqId.sh
      charset: UTF-8
  sinks:
    k1:
      type: file_roll
      channel: c1
      sink:
        directory: "/var/log/flume/agent_${f1['agent_name']} # will be /var/log/flume/agent_1234"
"a1": {
  "sources": "r1",
  "channels": "c1",
  "configfilters": {
    "f1": {
      "type": "external",
      "command": "/usr/bin/generateUniqId.sh",
      "charset": "UTF-8"
    }
  },
  "sinks": {
    "k1": {
      "type": "file_roll",
      "channel": "c1",
      "sink": {
        "directory": "/var/log/flume/agent_${f1['agent_name']} # will be /var/log/flume/agent_1234"
      }
    }
  }
}

In this example flume will run the following command to get the value

$ /usr/bin/generateUniqId.sh agent_name

The generateUniqId.sh will return 1234 with an exit code 0.

Custom Components

As noted in the sections on the individual types of Flume components, users may provide their own custom Sources, Sinks, Channels, SinkProcessors, ConfigFilters, ChannelSelectors, Interceptors, EventSerializers, and EventDeserializers.

The type property of a component’s configuration selects its implementation. It is either the fully qualified name of the component class or a short type name registered by a provider. Providers are discovered with java.util.ServiceLoader, so registering one lets users of your component write type = mysource instead of type = com.example.flume.MySource.

Each kind of component has its own provider interface:

Component Provider interface Component class

Source

org.apache.flume.spi.SourceProvider

org.apache.flume.Source

Channel

org.apache.flume.spi.ChannelProvider

org.apache.flume.Channel

Sink

org.apache.flume.spi.SinkProvider

org.apache.flume.Sink

Sink Processor

org.apache.flume.spi.SinkProcessorProvider

org.apache.flume.SinkProcessor

Channel Selector

org.apache.flume.spi.ChannelSelectorProvider

org.apache.flume.ChannelSelector

Interceptor

org.apache.flume.spi.InterceptorProvider

org.apache.flume.interceptor.Interceptor.Builder

Event Serializer

org.apache.flume.spi.EventSerializerProvider

org.apache.flume.serialization.EventSerializer.Builder

Event Deserializer

org.apache.flume.spi.EventDeserializerProvider

org.apache.flume.serialization.EventDeserializer.Builder

Config Filter

org.apache.flume.configfilter.ConfigFilterProvider

org.apache.flume.configfilter.ConfigFilter

A provider returns the type name with getName() and the component class with getComponentClass(). For components that are created through a builder, such as interceptors and event serializers, the component class is the builder class. The component class must have a public no-argument constructor. Type names are compared case-insensitively.

Writing a provider

The simplest way to write a provider is to extend org.apache.flume.spi.AbstractComponentProvider, which maps a fixed name to a fixed class:

package com.example.flume;

import org.apache.flume.Source;
import org.apache.flume.spi.AbstractComponentProvider;
import org.apache.flume.spi.SourceProvider;

public final class MySourceProvider extends AbstractComponentProvider<Source> implements SourceProvider {

    public MySourceProvider() {
        super("mysource", MySource.class);
    }
}

ConfigFilterProvider does not extend ComponentProvider, so a config filter provider implements getName() and getComponentClass() directly.

Registering a provider

Register the provider in a file named after the provider interface, in this case META-INF/services/org.apache.flume.spi.SourceProvider:

com.example.flume.MySourceProvider

If your code runs on the module path, declare the provider in your module-info.java instead:

module com.example.flume {
    requires org.apache.flume.core;
    provides org.apache.flume.spi.SourceProvider with com.example.flume.MySourceProvider;
}

If you build with bnd, as Flume itself does, you can annotate the provider with @aQute.bnd.annotation.spi.ServiceProvider(SourceProvider.class) and let bnd generate both the service file and the module descriptor.

Using the component

Put the JAR with your component and its provider on the agent’s class path and select it by its type name:

a1.sources.r1.type = mysource

Providers are loaded once, the first time a component of that kind is configured, so the agent must be restarted to pick up new providers. If two providers register the same type name, an error is logged at startup and any configuration that uses that type fails; use the fully qualified class name to avoid such a conflict.

Security

The Thrift source and Thrift sink support Kerberos authentication. Please refer to the corresponding sections for configuring the Kerberos-related options.

Flume agent will authenticate to the kerberos KDC as a single principal, which will be used by different components that require kerberos authentication. The principal and keytab configured for Thrift source and Thrift sink should be the same, otherwise the component will fail to start.

Monitoring

Monitoring in Flume is handled through the use of Java MBeans. Several Flume components report metrics to the JMX platform MBean server. These metrics can be queried using Jconsole. The statistics can also be returned via http.

Available Component Metrics

The following tables show what metrics are available for components. Each component only maintains a set of metrics, indicated by an 'x', the unmaintained ones show default values, that is 0. These tables tell you where you can expect meaningful data. The name of the metrics should be descriptive enough, for more information you have to dig into the source code of the components.

Sources 1

Avro

Exec

JMS

Kafka

MultiportSyslogTCP

AppendAcceptedCount

x

AppendBatchAcceptedCount

x

x

AppendBatchReceivedCount

x

x

AppendReceivedCount

x

ChannelWriteFail

x

x

x

x

EventAcceptedCount

x

x

x

x

x

EventReadFail

x

x

x

EventReceivedCount

x

x

x

x

x

GenericProcessingFail

x

KafkaCommitTimer

x

KafkaEmptyCount

x

KafkaEventGetTimer

x

OpenConnectionCount

x

Sources 2

SequenceGenerator

SpoolDirectory

SyslogTcp

SyslogUDP

Taildir

Thrift

AppendAcceptedCount

x

AppendBatchAcceptedCount

x

x

x

x

AppendBatchReceivedCount

x

x

x

AppendReceivedCount

x

ChannelWriteFail

x

x

x

x

x

x

EventAcceptedCount

x

x

x

x

x

x

EventReadFail

x

x

x

x

EventReceivedCount

x

x

x

x

x

GenericProcessingFail

x

x

Sinks

Avro/Thrift

Kafka

MongoDb

RollingFile

BatchCompleteCount

x

BatchEmptyCount

x

x

x

BatchUnderflowCount

x

x

x

ChannelReadFail

x

x

x

x

ConnectionClosedCount

x

x

ConnectionCreatedCount

x

x

ConnectionFailedCount

x

x

DuplicateEventCount

x

EventDrainAttemptCount

x

x

x

EventDrainSuccessCount

x

x

x

x

EventWriteFail

x

x

x

x

KafkaEventSendTimer

x

RollbackCount

x

The MongoDb sink’s DuplicateEventCount is the number of events that were not inserted because a document with the same key already exists in MongoDB. These events are not included in EventDrainSuccessCount, but they are not treated as failures either, so they do not cause the batch to be rolled back.

Channels

File

Kafka

Memory

PseudoTxnMemory

SpillableMemory

ChannelCapacity

x

x

x

ChannelSize

x

x

x

x

CheckpointBackupWriteErrorCount

x

CheckpointWriteErrorCount

x

EventPutAttemptCount

x

x

x

x

x

EventPutErrorCount

x

EventPutSuccessCount

x

x

x

x

x

EventTakeAttemptCount

x

x

x

x

x

EventTakeErrorCount

x

EventTakeSuccessCount

x

x

x

x

x

KafkaCommitTimer

x

KafkaEventGetTimer

x

KafkaEventSendTimer

x

Open

x

RollbackCounter

x

Unhealthy

x

JMX Reporting

JMX Reporting can be enabled by specifying JMX parameters in the JAVA_OPTS environment variable using flume-env.sh, like

export JAVA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=5445 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"

The sample above disables the security. To enable Security, please refer https://docs.oracle.com/javase/6/docs/technotes/guides/management/agent.html

Ganglia Reporting

Flume can also report these metrics to Ganglia 3 or Ganglia 3.1 metanodes. To report metrics to Ganglia, a flume agent must be started with this support. The Flume agent has to be started by passing in the following parameters as system properties prefixed by flume.monitoring., and can be specified in the flume-env.sh:

Property Name Default Description

type

 — 

The component type name, has to be ganglia

hosts

 — 

Comma-separated list of hostname:port of Ganglia servers

pollFrequency

60

Time, in seconds, between consecutive reporting to Ganglia server

isGanglia3

false

Ganglia server version is 3. By default, Flume sends in Ganglia 3.1 format

We can start Flume with Ganglia support as follows:

$ java -jar MyFlume-1.0.0.jar --conf-file example.conf --name a1 -Dflume.monitoring.type=ganglia -Dflume.monitoring.hosts=com.example:1234,com.example2:5455

JSON Reporting

Flume can also report metrics in a JSON format. To enable reporting in JSON format, Flume hosts a Web server on a configurable port. Flume reports metrics in the following JSON format:

{
"typeName1.componentName1" : {"metric1" : "metricValue1", "metric2" : "metricValue2"},
"typeName2.componentName2" : {"metric3" : "metricValue3", "metric4" : "metricValue4"}
}

Here is an example:

{
"CHANNEL.fileChannel":{"EventPutSuccessCount":"468085",
                      "Type":"CHANNEL",
                      "StopTime":"0",
                      "EventPutAttemptCount":"468086",
                      "ChannelSize":"233428",
                      "StartTime":"1344882233070",
                      "EventTakeSuccessCount":"458200",
                      "ChannelCapacity":"600000",
                      "EventTakeAttemptCount":"458288"},
"CHANNEL.memChannel":{"EventPutSuccessCount":"22948908",
                   "Type":"CHANNEL",
                   "StopTime":"0",
                   "EventPutAttemptCount":"22948908",
                   "ChannelSize":"5",
                   "StartTime":"1344882209413",
                   "EventTakeSuccessCount":"22948900",
                   "ChannelCapacity":"100",
                   "EventTakeAttemptCount":"22948908"}
}
Property Name Default Description

type

 — 

The component type name, has to be http

port

41414

The port to start the server on.

We can start Flume with JSON Reporting support as follows:

$ java -jar MyFlume-1.0.0.jar --conf-file example.conf --name a1 -Dflume.monitoring.type=http -Dflume.monitoring.port=34545

Metrics will then be available at http://<hostname>:<port>/metrics webpage. Custom components can report metrics as mentioned in the Ganglia section above.

Custom Reporting

It is possible to report metrics to other systems by writing servers that do the reporting. Any reporting class has to implement the interface, org.apache.flume.instrumentation.MonitorService. Such a class can be used the same way the GangliaServer is used for reporting. They can poll the platform mbean server to poll the mbeans for metrics. For example, if an HTTP monitoring service called HTTPReporting can be used as follows:

$ java -jar MyFlume-1.0.0.jar --conf-file example.conf --name a1 -Dflume.monitoring.type=com.example.reporting.HTTPReporting -Dflume.monitoring.node=com.example:332
Property Name Default Description

type

 — 

The component type name, has to be FQCN

Reporting metrics from custom components

Any custom flume components should inherit from the org.apache.flume.instrumentation.MonitoredCounterGroup class. The class should then provide getter methods for each of the metrics it exposes. See the code below. The MonitoredCounterGroup expects a list of attributes whose metrics are exposed by this class. As of now, this class only supports exposing metrics as long values.

public class SinkCounter extends MonitoredCounterGroup implements
    SinkCounterMBean {

  private static final String COUNTER_CONNECTION_CREATED =
    "sink.connection.creation.count";

  private static final String COUNTER_CONNECTION_CLOSED =
    "sink.connection.closed.count";

  private static final String COUNTER_CONNECTION_FAILED =
    "sink.connection.failed.count";

  private static final String COUNTER_BATCH_EMPTY =
    "sink.batch.empty";

  private static final String COUNTER_BATCH_UNDERFLOW =
      "sink.batch.underflow";

  private static final String COUNTER_BATCH_COMPLETE =
    "sink.batch.complete";

  private static final String COUNTER_EVENT_DRAIN_ATTEMPT =
    "sink.event.drain.attempt";

  private static final String COUNTER_EVENT_DRAIN_SUCCESS =
    "sink.event.drain.sucess";

  private static final String[] ATTRIBUTES = {
    COUNTER_CONNECTION_CREATED, COUNTER_CONNECTION_CLOSED,
    COUNTER_CONNECTION_FAILED, COUNTER_BATCH_EMPTY,
    COUNTER_BATCH_UNDERFLOW, COUNTER_BATCH_COMPLETE,
    COUNTER_EVENT_DRAIN_ATTEMPT, COUNTER_EVENT_DRAIN_SUCCESS
  };


  public SinkCounter(String name) {
    super(MonitoredCounterGroup.Type.SINK, name, ATTRIBUTES);
  }

  @Override
  public long getConnectionCreatedCount() {
    return get(COUNTER_CONNECTION_CREATED);
  }

  public long incrementConnectionCreatedCount() {
    return increment(COUNTER_CONNECTION_CREATED);
  }

}

Tools

File Channel Integrity Tool

File Channel Integrity tool verifies the integrity of individual Events in the File channel and removes corrupted Events. Before a data file is modified it is copied to a file with the same name and a .bak extension, and the corrupted Events are then marked as no-ops.

The data directories to verify can be specified directly:

java -jar flume-tools-2.0.0.jar FCINTEGRITYTOOL -l ./datadir

where datadir is the comma separated list of data directories to be verified.

Alternatively, the tool can read the agent’s configuration and verify the data directories of every File Channel configured for that agent:

java -jar flume-tools-2.0.0.jar FCINTEGRITYTOOL -u ./conf/flume.yml -n agent1

The configuration is located in the same way as with the agent’s -u option, so any supported URI may be used, such as file:, http:, https: or classpath:, optionally prefixed with optional:. A value without a scheme is treated as a file path. Properties and YAML configurations are supported. The -u option may be repeated to combine several configuration sources. A channel is treated as a File Channel when its type is file or org.apache.flume.channel.file.FileChannel. If a File Channel does not set dataDirs, the File Channel’s default of ~/.flume/file-channel/data is used. The tool exits with an error if the agent’s configuration cannot be found or is invalid, or if the agent has no File Channels.

-l and -u may be combined; each data directory is verified only once.

Following are the options available

Option Name Description

h/help

Displays help

l/dataDirs

Comma-separated list of data directories which the tool must verify. Required if conf-uri is not specified

u/conf-uri

URI or path of the agent configuration. The data directories of all the agent’s File Channels are verified. May be repeated. Required if dataDirs is not specified

n/name

The name of the agent whose File Channels should be verified. Required with conf-uri

a/auth-provider

Fully qualified class name of an AuthorizationProvider used to access conf-uri. The class must have a constructor that accepts a String[] containing the command line arguments

user/conf-user

User name used to access conf-uri with basic authentication

pwd/conf-password

Password used to access conf-uri with basic authentication

e/eventValidator

Fully Qualified Name of Event Validator Implementation. See Event Validator Tool

Event Validator Tool

Event validator tool can be used to validate the File Channel Event’s in application specific way. The tool applies the user provider validation login on each event and drop the event which do not confirm to the logic.

The tools can be run as follows:

java -jar flume-tools-2.0.0.jar FCINTEGRITYTOOL -l ./datadir -e org.apache.flume.MyEventValidator -DmaxSize 2000

where datadir is the comma separated list of data directory to be verified.

The option available are the same as those for the File Channel Integrity Tool above.

The Event validator implementation must implement EventValidator interface. It’s recommended not to throw any exception from the implementation as they are treated as invalid events. Additional parameters can be passed to EventValitor implementation via -D options.

Let’s see an example of simple size based Event Validator, which shall reject event’s larger than maximum size specified.

public static class MyEventValidator implements EventValidator {

  private int value = 0;

  private MyEventValidator(int val) {
    value = val;
  }

  @Override
  public boolean validateEvent(Event event) {
    return event.getBody() <= value;
  }

  public static class Builder implements EventValidator.Builder {

    private int sizeValidator = 0;

    @Override
    public EventValidator build() {
      return new DummyEventVerifier(sizeValidator);
    }

    @Override
    public void configure(Context context) {
      binaryValidator = context.getInteger("maxSize");
    }
  }
}

Topology Design Considerations

Flume is very flexible and allows a large range of possible deployment scenarios. If you plan to use Flume in a large, production deployment, it is prudent to spend some time thinking about how to express your problem in terms of a Flume topology. This section covers a few considerations.

Is Flume a good fit for your problem?

Flume is designed to transport and ingest regularly-generated event data over relatively stable, potentially complex topologies. The notion of "event data" is very broadly defined. To Flume, an event is just a generic blob of bytes. There are some limitations on how large an event can be - for instance, it cannot be larger than what you can store in memory or on disk on a single machine - but in practice, flume events can be everything from textual log entries to image files. The key property of an event is that they are generated in a continuous, streaming fashion. If your data is not regularly generated (i.e. you are trying to do a single bulk load of data into a MongoDB cluster) then Flume will still work, but it is probably overkill for your situation. Flume likes relatively stable topologies. Your topologies do not need to be immutable, because Flume can deal with changes in topology without losing data and can also tolerate periodic reconfiguration due to fail-over or provisioning. It probably won’t work well if you plant to change topologies every day, because reconfiguration takes some thought and overhead.

The sweet spot for Flume is when you have one or more applications generating event data from multiple machines in multiple locations that need to be delivered to one or more destinations. For example, if you have instances of a service that generates events that runs in multiple data centers around the country and those events need to be written to a MongoDB cluster Flume will handle that use case extremely well.

Flume can also handle capturing debug/diagnostic log events from applications and forwarding those to ElasticSearch but in that case the typical Filebeat → Logstash → ElasticSearch topology could be a better fit. However, if those log events require guaranteed delivery, such as in the case of audit logs, then Flume could work better since it guarantees events are delivered at least once.

Flow reliability in Flume

The reliability of a Flume flow depends on several factors. By adjusting these factors, you can achieve a wide array of reliability options with Flume.

What type of channel you use. Flume has both durable channels (those which will persist data to disk) and non durable channels (those which will lose data if a machine fails). Durable channels use disk-based storage, and data stored in such channels will persist across machine restarts or non disk-related failures.

Whether your channels are sufficiently provisioned for the workload. Channels in Flume act as buffers at various hops. These buffers have a fixed capacity, and once that capacity is full you will create back pressure on earlier points in the flow. If this pressure propagates to the source of the flow, Flume will become unavailable and may lose data.

Whether you use redundant topologies. Flume let’s you replicate flows across redundant topologies. This can provide a very easy source of fault tolerance and one which is overcomes both disk or machine failures.

The best way to think about reliability in a Flume topology is to consider various failure scenarios and their outcomes. What happens if a disk fails? What happens if a machine fails? What happens if your terminal sink (e.g. MongoDb) goes down for some time and you have back pressure? The space of possible designs is huge, but the underlying questions you need to ask are just a handful.

Flume topology design

The first step in designing a Flume topology is to enumerate all sources and destinations (terminal sinks) for your data. These will define the edge points of your topology. The next consideration is whether to introduce intermediate aggregation tiers or event routing. If you are collecting data form a large number of sources, it can be helpful to aggregate the data in order to simplify ingestion at the terminal sink. An aggregation tier can also smooth out burstiness from sources or unavailability at sinks, by acting as a buffer. If you are routing data between different locations, you may also want to split flows at various points: this creates sub-topologies which may themselves include aggregation points.

Sizing a Flume deployment

Once you have an idea of what your topology will look like, the next question is how much hardware and networking capacity is needed. This starts by quantifying how much data you generate. That is not always a simple task! Most data streams are bursty (for instance, due to diurnal patterns) and potentially unpredictable. A good starting point is to think about the maximum throughput you’ll have in each tier of the topology, both in terms of events per second and bytes per second. Once you know the required throughput of a given tier, you can calulate a lower bound on how many nodes you require for that tier. To determine attainable throughput, it’s best to experiment with Flume on your hardware, using synthetic or sampled event data. In general, disk-based channels should get 10’s of MB/s and memory based channels should get 100’s of MB/s or more. Performance will vary widely, however depending on hardware and operating environment.

Sizing aggregate throughput gives you a lower bound on the number of nodes you will need to each tier. There are several reasons to have additional nodes, such as increased redundancy and better ability to absorb bursts in load.

In today’s world where terrabytes of fast storage are relatively cheap, creating a Flume cluster can be fairly inexpensive. Flume generally uses very little CPU and JVM heap so a small VM or pod can be utilized.

Troubleshooting

Handling agent failures

If the Flume agent goes down, then the all the flows hosted on that agent are aborted. Once the agent is restarted, then flow will resume. The flow using file channel or other stable channel will resume processing events where it left off. If the agent can’t be restarted on the same hardware, then there is an option to migrate the database to another hardware and setup a new Flume agent that can resume processing the events saved in the db. The database HA futures can be leveraged to move the Flume agent to another host.

Avro compatibility

This content is provided by the Flume RPC module. See Avro compatibility in the Flume RPC documentation.

Component Summary

Component Interface Type Alias Repository Implementation Class

org.apache.flume.Channel

memory

logging-flume

org.apache.flume.channel.MemoryChannel

org.apache.flume.Channel

jdbc

logging-flume-jdbc

org.apache.flume.channel.jdbc.JdbcChannel

org.apache.flume.Channel

file

logging-flume

org.apache.flume.channel.file.FileChannel

org.apache.flume.Channel

 — 

logging-flume

org.apache.flume.channel.PseudoTxnMemoryChannel

org.apache.flume.Channel

spillablememory

logging-flume

org.apache.flume.channel.spillable.SpillableMemoryChannel

org.apache.flume.Channel

kafka

logging-flume-kafka

org.apache.flume.channel.kafka.KafkaChannel

org.apache.flume.Source

avro

logging-flume-rpc

org.apache.flume.source.avro.AvroSource

org.apache.flume.Source

netcat

logging-flume

org.apache.flume.source.NetcatSource

org.apache.flume.Source

netcatudp

logging-flume

org.apache.flume.source.netcat.NetcatUdpSource

org.apache.flume.Source

seq

logging-flume

org.apache.flume.source.SequenceGeneratorSource

org.apache.flume.Source

exec

logging-flume

org.apache.flume.source.ExecSource

org.apache.flume.Source

syslogtcp

logging-flume

org.apache.flume.source.syslog.SyslogTcpSource

org.apache.flume.Source

multiport_syslogtcp

logging-flume

org.apache.flume.source.syslog.MultiportSyslogTCPSource

org.apache.flume.Source

syslogudp

logging-flume

org.apache.flume.source.syslog.SyslogUDPSource

org.apache.flume.Source

spooldir

logging-flume-rpc

org.apache.flume.source.spooldir.SpoolDirectorySource

org.apache.flume.Source

taildir

logging-flume

org.apache.flume.source.taildir.TaildirSource

org.apache.flume.Source

http

logging-flume-http

org.apache.flume.http.source.HTTPSource

org.apache.flume.Source

thrift

logging-flume-rpc

org.apache.flume.source.thrift.ThriftSource

org.apache.flume.Source

jms

logging-flume-jms

org.apache.flume.source.jms.JMSSource

org.apache.flume.Source

kafka

logging-flume-kafka

org.apache.flume.source.kafka.KafkaSource

org.apache.flume.Sink

null

logging-flume

org.apache.flume.sink.NullSink

org.apache.flume.Sink

logger

logging-flume

org.apache.flume.sink.LoggerSink

org.apache.flume.Sink

avro

logging-flume-rpc

org.apache.flume.sink.avro.AvroSink

org.apache.flume.Sink

file_roll

logging-flume

org.apache.flume.sink.RollingFileSink

org.apache.flume.Sink

thrift

logging-flume-rpc

org.apache.flume.sink.thrift.ThriftSink

org.apache.flume.Sink

mongodb

logging-flume-mongodb

org.apache.flume.sink.mongodb.MongoDbSink

org.apache.flume.Sink

http

logging-flume-http

org.apache.flume.http.sink.HttpSink

org.apache.flume.Sink

kafka

logging-flume-kafka

org.apache.flume.sink.kafka.KafkaSink

org.apache.flume.ChannelSelector

replicating

logging-flume

org.apache.flume.channel.ReplicatingChannelSelector

org.apache.flume.ChannelSelector

multiplexing

logging-flume

org.apache.flume.channel.MultiplexingChannelSelector

org.apache.flume.ChannelSelector

load_balancing

logging-flume

org.apache.flume.channel.LoadBalancingChannelSelector

org.apache.flume.ChannelSelector

routable_proxy

logging-flume

org.apache.flume.channel.RoutableProxyChannelSelector

org.apache.flume.SinkProcessor

default

logging-flume

org.apache.flume.sink.DefaultSinkProcessor

org.apache.flume.SinkProcessor

failover

logging-flume

org.apache.flume.sink.FailoverSinkProcessor

org.apache.flume.SinkProcessor

load_balance

logging-flume

org.apache.flume.sink.LoadBalancingSinkProcessor

org.apache.flume.interceptor.Interceptor

timestamp

logging-flume

org.apache.flume.interceptor.TimestampInterceptor$Builder

org.apache.flume.interceptor.Interceptor

host

logging-flume

org.apache.flume.interceptor.HostInterceptor$Builder

org.apache.flume.interceptor.Interceptor

static

logging-flume

org.apache.flume.interceptor.StaticInterceptor$Builder

org.apache.flume.interceptor.Interceptor

regex_filter

logging-flume

org.apache.flume.interceptor.RegexFilteringInterceptor$Builder

org.apache.flume.interceptor.Interceptor

regex_extractor

logging-flume

org.apache.flume.interceptor.RegexExtractorInterceptor$Builder

org.apache.flume.interceptor.Interceptor

search_replace

logging-flume

org.apache.flume.interceptor.SearchAndReplaceInterceptor$Builder

org.apache.flume.interceptor.Interceptor

remove_header

logging-flume

org.apache.flume.interceptor.RemoveHeaderInterceptor$Builder

org.apache.flume.channel.file.encryption.KeyProvider$Builder

jceksfile

logging-flume

org.apache.flume.channel.file.encryption.JCEFileKeyProvider

org.apache.flume.channel.file.encryption.CipherProvider

aesctrnopadding

logging-flume

org.apache.flume.channel.file.encryption.AESCTRNoPaddingProvider

org.apache.flume.serialization.EventSerializer$Builder

text

logging-flume

org.apache.flume.serialization.BodyTextEventSerializer$Builder

org.apache.flume.serialization.EventSerializer$Builder

header_and_text

logging-flume

org.apache.flume.serialization.HeaderAndBodyTextEventSerializer$Builder

org.apache.flume.serialization.EventSerializer$Builder

avro_event

logging-flume-rpc

org.apache.flume.serialization.avro.FlumeEventAvroEventSerializer$Builder

Alias Conventions

These conventions for alias names are used in the component-specific examples above, to keep the names short and consistent across all examples.

Alias Name Alias Type

a

agent

c

channel

r

source

k

sink

g

sink group

i

interceptor

y

key

h

host

s

serializer

Deprecated and Removed Components and Features

Zookeeper based Configuration

Flume 1.x supported Agent configurations via Zookeeper. This was an experimental feature. This feature is no longer included in Flume releases however the supporting code can still be found in the flume-zookeeper module in the logging-flume-legacy repository.

The configuration file needs to be uploaded in the Zookeeper, under a configurable prefix. The configuration file is stored in Zookeeper Node data. Following is how the Zookeeper Node tree would look like for agents a1 and a2

- /flume
 |- /a1 [Agent config file]
 |- /a2 [Agent config file]

Once the configuration file is uploaded, start the agent with following options

$ java --conf conf -z zkhost:2181,zkhost1:2181 -p /flume --name a1 -jar MyFlume.jar

Argument Name Default Description

z

 — 

Zookeeper connection string. Comma separated list of hostname:port

p

/flume

Base Path in Zookeeper to store Agent configurations

Installing third-party plugins

Flume 1.x was delivered as a single binary zip with a shell script and with classes and jar files in directories. Flume 2.x is designed to be built by the user using Maven and packaged with the repack-maven-plugin. Since the user can simply add their own dependencies and classes to the build there is no need to provide a plugin system simply to allow custom Flume components to be added.

Retired Components

Components marked as "retired" were not migrated from Flume 1.x primarily because they rely on third party dependencies that have not been maintained in several years. Components marked as "dormant" were not migrated from Flume 1.x since none of the active committers have a need for them and do not have the time to sufficiently test changes to them. However, these may be revived should volunteers come forward who will maintain them.

Retired Sources

Component GitHub Repo Status Reason

Avro Legacy

logging-flume-legacy

Retired

Bridge to Flume 0.9 no longer needed

Scribe

logging-flume-legacy

Dormant

No Flume Committer

Thrift Legacy

logging-flume-legacy

Retired

Bridge to Flume 0.9 no longer needed

Twitter

logging-flume-thrift

Retired

Unmaintained dependency

Retired Sinks

Component GitHub Repo Status Reason

Async HBase

logging-flume-hadoop

Dormant

No FLume Committer Support

ElasticSearch

logging-flume-search

Dormant

No Flume Committer Support

HBase

logging-flume-hadoop

Dormant

No Flume Committer Support

HBase2

logging-flume-hadoop

Dormant

No Flume Committer Support

HDFS

logging-flume-hadoop

Dormant

No Flume Committer Support

Hive

logging-flume-hadoop

Dormant

No Flume Committer Support

IRC

logging-flume-irc

Retired

Unmaintained dependency

MorphlineSolrSink

logging-flume-morphline

Retired

Unmaintained dependency

Retired Interceptors

Component GitHub Repo Status Reason

Morphline

logging-flume-morphline

Retired

Unmaintained dependency

Log4j 1.x Appender

The Log4j 1.x Appender was retired since Log4j 1 has not been supported since 2015.