elasticout
index
/build/dshell/src/dshell/lib/output/elasticout.py

Created on May 6, 2015
 
@author: amm

 
Modules
       
datetime
dfile
dshell
elasticsearch
logging
output
sys

 
Classes
       
output.TextOutput(output.FileOutput)
elasticout

 
class elasticout(output.TextOutput)
    ElasticSearch Output module
use with --output=elasticout
 
e.g.  decode -d web *pcap --output elasticout,host=192.168.10.10,index=dshell
 
        options
        -------
        host:         <host>:<ip> of an Elasticsearch search node  (REQUIRED)
        index:        Elasticsearch index  (REQUIRED)
        doc_type:     Elasticsearch document type for indexed documents
        geoip:        If set to Y, output module won't discard geoip tags
        notrim:       If set to Y, do not trim any fields from the output
        message:      If set to Y, add the decoder output message (args[0])
                         as a "message" field in elasticsearch
 
 
Method resolution order:
elasticout
output.TextOutput
output.FileOutput
output.Output
__builtin__.object

Methods defined here:
__init__(self, *args, **kwargs)
alert(self, *args, **kw)
write(self, *args, **kwargs)

Data and other attributes defined here:
ELASTIC_HOST_LIST = []
ELASTIC_INDEX = None

Methods inherited from output.FileOutput:
close(self)
close output if not stdout

Methods inherited from output.Output:
dispatch(self, m, *args, **kwargs)
dispatch from Q pop
dump(self, pkt=None, **kw)
dump raw packet data to an output
override this if you want a format other than pcap
log(self, msg, level=20, *args, **kw)
write a message to the log
passes all args and kwargs thru to logging
except for level= is used to set logging level
parse(self, *args, **kw)
parse the input args/kwargs into a record dict according to format string
- timestamps are formatted to date/time strings
        - fields not in the input will be defined but blank
        - extra fields in the record will be formatted into a
               "name=value name2=value2..." string and put in 'extra'
        - args will go into 'data'
        - format keyword can contain a new format string to use (this also sets format for future output)
setformat(self, formatstr=None, typemap=None)
parse a format string and extract the field info
        if no string given, reverts to default for class
   will set self.fields to be a list of (name,type,spec) tuples
   self.fieldnames to a list of fieldnames
        and self.fieldmap to a list of key=in value=out mappings
format string can also map in field to out field with %(in:out)spectype
 or specify an explicit out type with %(in:out)specintype:outtype
(note this breaks compatibility with text formatting,
  but useful for db or other output modules)
  a typemap of [intype]=outtype (or [in]=(newintype,outtype)
                  can be used to map and replace types
setup(self)
Perform any additional setup outside of the standard __init__.
Runs after command-line arguments are parsed, but before decoders are run.
For example, printing header data to the outfile.

Data descriptors inherited from output.Output:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
obj = class elasticout(output.TextOutput)
    ElasticSearch Output module
use with --output=elasticout
 
e.g.  decode -d web *pcap --output elasticout,host=192.168.10.10,index=dshell
 
        options
        -------
        host:         <host>:<ip> of an Elasticsearch search node  (REQUIRED)
        index:        Elasticsearch index  (REQUIRED)
        doc_type:     Elasticsearch document type for indexed documents
        geoip:        If set to Y, output module won't discard geoip tags
        notrim:       If set to Y, do not trim any fields from the output
        message:      If set to Y, add the decoder output message (args[0])
                         as a "message" field in elasticsearch
 
 
Method resolution order:
elasticout
output.TextOutput
output.FileOutput
output.Output
__builtin__.object

Methods defined here:
__init__(self, *args, **kwargs)
alert(self, *args, **kw)
write(self, *args, **kwargs)

Data and other attributes defined here:
ELASTIC_HOST_LIST = []
ELASTIC_INDEX = None

Methods inherited from output.FileOutput:
close(self)
close output if not stdout

Methods inherited from output.Output:
dispatch(self, m, *args, **kwargs)
dispatch from Q pop
dump(self, pkt=None, **kw)
dump raw packet data to an output
override this if you want a format other than pcap
log(self, msg, level=20, *args, **kw)
write a message to the log
passes all args and kwargs thru to logging
except for level= is used to set logging level
parse(self, *args, **kw)
parse the input args/kwargs into a record dict according to format string
- timestamps are formatted to date/time strings
        - fields not in the input will be defined but blank
        - extra fields in the record will be formatted into a
               "name=value name2=value2..." string and put in 'extra'
        - args will go into 'data'
        - format keyword can contain a new format string to use (this also sets format for future output)
setformat(self, formatstr=None, typemap=None)
parse a format string and extract the field info
        if no string given, reverts to default for class
   will set self.fields to be a list of (name,type,spec) tuples
   self.fieldnames to a list of fieldnames
        and self.fieldmap to a list of key=in value=out mappings
format string can also map in field to out field with %(in:out)spectype
 or specify an explicit out type with %(in:out)specintype:outtype
(note this breaks compatibility with text formatting,
  but useful for db or other output modules)
  a typemap of [intype]=outtype (or [in]=(newintype,outtype)
                  can be used to map and replace types
setup(self)
Perform any additional setup outside of the standard __init__.
Runs after command-line arguments are parsed, but before decoders are run.
For example, printing header data to the outfile.

Data descriptors inherited from output.Output:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        __warningregistry__ = {("Not importing directory '/build/dshell/src/dshell/lib/output': missing __init__.py", <type 'exceptions.ImportWarning'>, 8): True}