GithubHelp home page GithubHelp logo

luolidong / flume-json-interceptor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from schibsted-tech-polska/flume-json-interceptor

0.0 2.0 0.0 23 KB

Flume JSON Interceptor Plugin

License: Apache License 2.0

Java 100.00%

flume-json-interceptor's Introduction

flume-json-interceptor

Flume JSON Interceptor Plugin extend Flume NG - now you can add headers getted from JSON document throught JSONPath.

JSONPath is XPath for JSON. Specyfication: http://goessner.net/articles/JsonPath/

Compilation

You can compile these using Maven (which you have to install first) by running

mvn clean package

from your command prompt.

Installation

Extract file flume-json-interceptor-x.y.z-flume-plugin.tar to directory: plugins.d/flume-json-interceptor/.

If you use Cloudera Distrybution Hadoop, this will probably be /usr/lib/flume-ng/plugins.d/plugins.d/flume-json-interceptor/.

Configuration

Simple configuration to get element from action property and put it as header action.

Example:

a1.sources.s1.interceptors = i1
a1.sources.s1.interceptors.i1.type = pl.schibsted.flume.interceptor.json.JsonInterceptor$Builder
a1.sources.s1.interceptors.i1.name = action
a1.sources.s1.interceptors.i1.jsonpath = $.action

Configuration to get element from published property and put it as header timestamp throught serializer.

Example:

a1.sources.s1.interceptors = i2
a1.sources.s1.interceptors.i2.type = pl.schibsted.flume.interceptor.json.JsonInterceptor$Builder
a1.sources.s1.interceptors.i2.name = timestamp
a1.sources.s1.interceptors.i2.jsonpath = $.published
a1.sources.s1.interceptors.i2.serializers = dt
a1.sources.s1.interceptors.i2.serializers.dt.type=pl.schibsted.flume.interceptor.json.JsonInterceptorMillisSerializer
a1.sources.s1.interceptors.i2.serializers.dt.pattern=yyyy-MM-dd'T'HH:mm:ssZ
a1.sources.s1.interceptors.i2.serializers.dt.name=timestamp

Example JSON document:

{
  action: "pageview",
  published: "2015-05-06T12:34:54+02:00"
}

Error handling

  1. If specified JSONPath element not exists, event is passed without modifications.

  2. If JSON is malformed, event is passed without modifications.

flume-json-interceptor's People

Contributors

wojtekk avatar darouwan avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.