Modified for logstash - first working version