As I do a lot of testing and CI in my day job, I took ELK for a test drive.
(ELK stands for ElasticSearch, LogStash and Kibana)
I’ve played around with Logstash before, but it’s first time i’m trying Kibana.
I’ve look for a quick way to setup it, and there where gazillion hits in Docker Hub
(I’ve forgot which one I’ve actually installed :))
EDIT: it was cyberabis/docker-elkauto.
That went quick quickly, with a small change that I’ve used port 81
Next thing I wanted to feed it with some data, good thing someone else added some key=value files to our CI just a few days ago (Thanks Mike).
And I had first real data in to play with in matter of minutes
That’s was not enough for me, I wanted all the information from my tests.
Seem like the junit-xml output has all the information I wanted.
I hated the idea of running something after the tests are running,
I wanted it to run automatic on any test I’ll run with py.test.
Took me some time to figure it out which py.test hook fits the best, and here’s how it can be done:
Just for reference, to show how simple is the logstash configuration, almost untouched:
input {
tcp { port => 3333 type => "text event"}
tcp { port => 3334 type => "json event" codec => json_lines {} }
}
filter {
if [createTime] {
date {
match => [ "createTime", "ISO8601" ]
target => "@timestamp"
}
}
}
output { elasticsearch { host => localhost } }