fuse_kafka
 All Data Structures Files Functions Variables Defines
Public Member Functions | Data Fields
build.FuseKafkaLog Class Reference

Public Member Functions

def __init__
def run_command
def pretty_print
def load_fuse_kafka_event
def start

Data Fields

 select
 zkconnect

Detailed Description

Utility to read messages from kafka based on fuse kafka format 

Definition at line 153 of file build.py.


Member Function Documentation

def build.FuseKafkaLog.load_fuse_kafka_event (   self,
  string 
)
Decodes a json logstash/fuse_kafka event string, i.e.:
- does a json decoding
- decodes @message and command fields 
- adds message_size-added field 

string - the JSON input logstash/fuse_kafka event

Example
    
    build.FuseKafkaLog().load_fuse_kafka_event(
      '{"command": "bXkgY29tbWFuZGU=", "@message": "bXkgbWVzc2FnZQ=="}')

    => {'message_size-added': 10,
u'command': 'my commande',
u'@message': 'my message'}

Returns the decoded json object

Definition at line 207 of file build.py.

def build.FuseKafkaLog.pretty_print (   self,
  string 
)
Displays a json logstash/fuse_kafka event in a user friendly fashion

string - the JSON input logstash/fuse_kafka event

Example

    pretty_print('{"command": "bXkgY29tbWFuZA==", "@message": "bXkgbWVzc2FnZQ==", '
+ '"fields": {"a": "v"}, "tags": ["tag"]}')

    prints:

event:
  message_size-added: 0
  fields:
     a: v
  command: my command
  @message: my message
  tags:
    -  tag

Definition at line 169 of file build.py.

def build.FuseKafkaLog.run_command (   self,
  command 
)
Run an interactive command line

command - the command to run as an argument array

Returns an iterator to the command stdout

Definition at line 158 of file build.py.

def build.FuseKafkaLog.start (   self)
Launches a kafka console consumer and pretty prints 
    fuse_kafka/logstash events from this consumer

- SELECT (environment variable): if defined, lists what field 
    names should be retrieved (whitespace separated)

Definition at line 232 of file build.py.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Defines