# Split filter - get index of splitted logs

**URL:** <https://discuss.elastic.co/t/split-filter-get-index-of-splitted-logs/156054>\
**Category:** Logstash\
**Created:** [November 9, 2018, 1:06pm UTC](https://discuss.elastic.co/t/split-filter-get-index-of-splitted-logs/156054 "2018-11-09T13:06:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![benoit\_elk](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@benoit\_elk](https://discuss.elastic.co/u/benoit_elk)\
**Post date:** [November 9, 2018, 1:06pm UTC](https://discuss.elastic.co/t/split-filter-get-index-of-splitted-logs/156054/1 "2018-11-09T13:06:52Z")

</div>

I am using Logstash split filter plugin as described in this page : [https://www.elastic.co/guide/en/logstash/current/plugins-filters-split.html](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"}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 7, 2018, 1:07pm UTC](https://discuss.elastic.co/t/split-filter-get-index-of-splitted-logs/156054/2 "2018-12-07T13:07:07Z")

</div>

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