input { file { path => "/data/logs/access.log" mode => "read" sincedb_path => "/dev/null" exit_after_read => true file_completed_action => "log" file_completed_log_path => "/tmp/completed.log" } } filter { grok { match => { "message" => "%{COMBINEDAPACHELOG}" } ecs_compatibility => v8 } date { match => [ "timestamp", "dd/MMM/yyyy:HH:mm:ss Z" ] remove_field => [ "timestamp" ] } } output { if "_grokparsefailure" in [tags] { elasticsearch { hosts => ["http://cr-logstash-es:9200"] index => "nginx-failed" } } else { elasticsearch { hosts => ["http://cr-logstash-es:9200"] index => "nginx-access" } } }