|
|
@ -4,18 +4,19 @@ from wowstash import config
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def send_es(data):
|
|
|
|
def send_es(data):
|
|
|
|
try:
|
|
|
|
if getattr(config, 'ELASTICSEARCH_ENABLED', False):
|
|
|
|
es = Elasticsearch(
|
|
|
|
try:
|
|
|
|
[getattr(config, 'ELASTICSEARCH_HOST', 'localhost')]
|
|
|
|
es = Elasticsearch(
|
|
|
|
)
|
|
|
|
[getattr(config, 'ELASTICSEARCH_HOST', 'localhost')]
|
|
|
|
now = datetime.utcnow()
|
|
|
|
)
|
|
|
|
index_ts = now.strftime('%Y%m%d')
|
|
|
|
now = datetime.utcnow()
|
|
|
|
data['datetime'] = now
|
|
|
|
index_ts = now.strftime('%Y%m%d')
|
|
|
|
es.index(
|
|
|
|
data['datetime'] = now
|
|
|
|
index="{}-{}".format(
|
|
|
|
es.index(
|
|
|
|
getattr(config, 'ELASTICSEARCH_INDEX_NAME', 'wowstash'),
|
|
|
|
index="{}-{}".format(
|
|
|
|
index_ts
|
|
|
|
getattr(config, 'ELASTICSEARCH_INDEX_NAME', 'wowstash'),
|
|
|
|
), body=data)
|
|
|
|
index_ts
|
|
|
|
except Exception as e:
|
|
|
|
), body=data)
|
|
|
|
print('Could not capture event in Elasticsearch: ', e)
|
|
|
|
except Exception as e:
|
|
|
|
pass # I don't really care if this logs...
|
|
|
|
print('Could not capture event in Elasticsearch: ', e)
|
|
|
|
|
|
|
|
pass # I don't really care if this logs...
|
|
|
|