Split filter - get index of splitted logs


(Benoit Hugonnard) #1

I am using Logstash split filter plugin as described in this page : https://www.elastic.co/guide/en/logstash/current/plugins-filters-split.html

Let say I have data looking like that :

{"log_id": "abcd", "logs": [{"val": 3}, {"val": 4}]}

Using the split filter like this :

filter { split { field => "logs" } }

Would output documents as follow :

{"log_id": "abcd", "logs": {"val": 3}}
{"log_id": "abcd", "logs": {"val": 4}}

I would like to extract the index of the splited document to use as unique id as follow :

{"log_id": "abcd", "logs": {"val": 3}, "unique_id": "abcd-0"}
{"log_id": "abcd", "logs": {"val": 4}, "unique_id": "abcd-1"}

(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.