The code I used shows below. I want to send logs with python. But What I got from Kibana is :
elk_1 | {"type":"log","@timestamp":"2017-05-10T04:23:51Z","tags":["connection","client","error"],"pid":194,"level":"error","message":"Parse Error","error":{"message":"Parse Error","name":"Error","stack":"Error: Parse Error\n at Error (native)","code":"HPE_INVALID_METHOD"}}
The images I used is here :https://github.com/spujadas/elk-docker/tree/master/nginx-filebeat
Is there any better solution for python? Thanks!
test.py
import logger
logger = logger.configure()
logger.info('hello world')
#logger.py
import logging
import logstash
import logging.handlers
def configure():
host = '10.211.55.12'
logging.basicConfig(level=logging.DEBUG,
format="%(asctime)s - %(module)s - line %(lineno)d - process-id %(process)d - (%(threadName)-5s)- %(levelname)s - %(message)s")
# fileConfig(log_file_path)
logger = logging.getLogger(__name__)
logger.addHandler(logstash.TCPLogstashHandler(host, 5601, version=1))
return logger