mirror of https://github.com/cowrie/cowrie.git
Update elasticsearch output module in order to use official python library (#706)
* Change the package pyes -> elasticsearch (the official one) * Update the output module in order to use elasticsearch library
This commit is contained in:
parent
49be876532
commit
230d5e2102
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
from __future__ import division, absolute_import
|
from __future__ import division, absolute_import
|
||||||
|
|
||||||
import pyes
|
from elasticsearch import Elasticsearch
|
||||||
|
|
||||||
import cowrie.core.output
|
import cowrie.core.output
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class Output(cowrie.core.output.Output):
|
||||||
"""
|
"""
|
||||||
self.host = CONFIG.get('output_elasticsearch', 'host')
|
self.host = CONFIG.get('output_elasticsearch', 'host')
|
||||||
self.port = CONFIG.get('output_elasticsearch', 'port')
|
self.port = CONFIG.get('output_elasticsearch', 'port')
|
||||||
self.index =CONFIGg.get('output_elasticsearch', 'index')
|
self.index =CONFIG.get('output_elasticsearch', 'index')
|
||||||
self.type = CONFIG.get('output_elasticsearch', 'type')
|
self.type = CONFIG.get('output_elasticsearch', 'type')
|
||||||
cowrie.core.output.Output.__init__(self)
|
cowrie.core.output.Output.__init__(self)
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class Output(cowrie.core.output.Output):
|
||||||
def start(self):
|
def start(self):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
self.es = pyes.ES('{0}:{1}'.format(self.host, self.port))
|
self.es = Elasticsearch('{0}:{1}'.format(self.host, self.port))
|
||||||
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
@ -44,5 +44,4 @@ class Output(cowrie.core.output.Output):
|
||||||
if i.startswith('log_'):
|
if i.startswith('log_'):
|
||||||
del logentry[i]
|
del logentry[i]
|
||||||
|
|
||||||
self.es.index(logentry, self.index, self.type)
|
self.es.index(index=self.index, doc_type=self.type, body=logentry)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ csirtgsdk>=0.0.0a17 # Specify version because pip won't install pre-release vers
|
||||||
requests
|
requests
|
||||||
|
|
||||||
# elasticsearch
|
# elasticsearch
|
||||||
pyes
|
elasticsearch
|
||||||
|
|
||||||
# mysql
|
# mysql
|
||||||
# If this fails, see documentation /home/cowrie/cowrie/doc/sql/README.md
|
# If this fails, see documentation /home/cowrie/cowrie/doc/sql/README.md
|
||||||
|
|
Loading…
Reference in New Issue