Added Elasticsearch Handler for better Log output/visibility of error messages and infos.

Reformated API endpoints to be in a better order.
Updated .gitignore to exclude config.
Added requirments.txt
Removed handler.py
This commit is contained in:
ZKWolf
2023-05-31 23:16:37 +02:00
parent 827179d80e
commit 808268bf8f
6 changed files with 83 additions and 43 deletions

View File

@@ -0,0 +1,14 @@
from datetime import datetime, date
from elasticsearch import Elasticsearch
import json
def es_upload(server, index, log_message):
if type(log_message) is not dict:
log_message = {"steam_key": log_message}
log_message["timestamp"] = datetime.utcnow().isoformat()
es = Elasticsearch(server)
data = json.dumps(log_message)
response = es.index(index=index, body=data, headers={'Content-Type': 'application/json;charset=UTF-8'})
document_id = response['_id']
print("Uploaded dictionary with ID:", document_id)

View File

@@ -1,5 +0,0 @@
def post_handler(data):
print("Post respond:")
print(data)
print("END OF RESPOND")