Skip to content

flume interceptor, set parsed timestamp value on event header, if included timestamp value on Json format document.

License

Notifications You must be signed in to change notification settings

kyanagimoto/json-body-timestamp-interceptor

Repository files navigation

Flume Interceptor: json-body-timestamp-interceptor

This project provides an interceptor for Flume.

requirement

  • Source data is JSON structure.
  • It's need to included timestamp value on Json head level.
  • It will put on the Sink header.

How to use

  1. Clone project
  2. Build with Maven
cd ./json-body-timestamp-interceptor
mvn clean install
  1. The jar file will be installed in your local maven repository and can be found in sub-directory.
    Add it on Flume classpath.
cp ./target/json-body-timestamp-interceptor-0.X.jar /path/to/flume/dir/lib
  1. Configure Flume conf file. Saved values (timestampYear, timestampMonth, timestampDay, timestampHour) on flume event header.

example)

agent.sources = r1
agent.sinks = s1

agent.sources.r1.interceptor = i1
agent.sources.r1.interceptors.i1.type = org.kyanagimoto.flume.interceptor.JsonBodyTimestampInterceptor$Builder
agent.sources.r1.interceptors.i1.properties.timestampKeyName = @timestamp
agent.sources.r1.interceptors.i1.properties.dateTimeFormat = yyyy-MM-dd'T'HH:mm:ss.SSS'Z'

agent.sinks.s1.hdfs.path = hdfs://path/%{timestampYear}/%{timestampMonth}/%{timestampDay}/%{timestampHour}

Change Log

v0.1.1

move property value on flume property file.

v0.1.2

change org.apache -> org.kyanagimoto

v0.1.3

add header information.

About

flume interceptor, set parsed timestamp value on event header, if included timestamp value on Json format document.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages