# Logstash Mutate Filter

**URL:** <https://discuss.elastic.co/t/logstash-mutate-filter/306057>\
**Category:** Logstash\
**Created:** [May 31, 2022, 4:45pm UTC](https://discuss.elastic.co/t/logstash-mutate-filter/306057 "2022-05-31T16:45:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tusharnemade](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tusharnemade](https://discuss.elastic.co/u/tusharnemade)\
**Post date:** [May 31, 2022, 4:45pm UTC](https://discuss.elastic.co/t/logstash-mutate-filter/306057/1 "2022-05-31T16:45:49Z")

</div>

Hello

I am using Logstash version 7.8.0 in our environment.

I am using logstash to extract data from JDBC database using input - jdbc and output == Elasticsearch v7.8.0

doing so , in between I am using filter - mutate as follows ...

```auto
filter {
  mutate {
    copy => { "[object_id][last_updated_date]" => "[@metadata][_id]"}
  }
}

```

In here , my JDBC , has two fields object\_id and last\_updated\_date making an record as unique in entire table.

Hence i would like to pass same to \_id in Elasticsearch.

But Its not working as expected. This mine above SYNTAX is failing.

Could someone please help me to how to put two columns data into \_id .

Thank You.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [May 31, 2022, 5:39pm UTC](https://discuss.elastic.co/t/logstash-mutate-filter/306057/2 "2022-05-31T17:39:16Z")

</div>

Use

```
mutate { add_field => { "[@metadata][_id]" => "%{[object_id]}-%{[last_updated_date]}" } }

```

Using the - to separate the two fields is optional.

---

<div class="post-metadata">

**Author:** ![tusharnemade](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tusharnemade](https://discuss.elastic.co/u/tusharnemade)\
**Post date:** [June 1, 2022, 3:14am UTC](https://discuss.elastic.co/t/logstash-mutate-filter/306057/3 "2022-06-01T03:14:34Z")

</div>

> [@Badger](#):
>
> ```auto
> mutate { add_field => { "[@metadata][_id]" => "%{[object_id]}-%{[last_updated_date]}" } }
> 
> ```

Yes , this worked 100%, Thank You ..

---

<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:** [June 29, 2022, 3:15am UTC](https://discuss.elastic.co/t/logstash-mutate-filter/306057/4 "2022-06-29T03:15:04Z")

</div>

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