A proof of concept of structured logging from Python to an Elasticsearch + Logstash + Kibana environment using Docker ELK, structlog and python-logstash.
docker-compose up
, and wait for a bit, the app will start up first, then Elasticsearch and Kibana and finally Logstash- As described in the docker-elk initial setup run the fllowing command to create the initial logstash index
$ curl -XPOST -D- 'http://localhost:5601/api/saved_objects/index-pattern' \
-H 'Content-Type: application/json' \
-H 'kbn-version: 6.1.0' \
-d '{"attributes":{"title":"logstash-*","timeFieldName":"@timestamp"}}'
curl http://localhost:8888/
, should print "Hello, World" and forward a first entry. You should see Logstash output in the terminal.- Visit
http://localhost:5601/
to open up Kibana, click on Discover and you should see two entries under alogstash-*
index. - Visit
http://localhost:8888/boom/
to log an exception.