# Merge 2 fields from seperate events into one field

**URL:** <https://discuss.elastic.co/t/merge-2-fields-from-seperate-events-into-one-field/190587>\
**Category:** Logstash\
**Created:** [July 15, 2019, 4:58pm UTC](https://discuss.elastic.co/t/merge-2-fields-from-seperate-events-into-one-field/190587 "2019-07-15T16:58:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![swiftingdarkness](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@swiftingdarkness](https://discuss.elastic.co/u/swiftingdarkness)\
**Post date:** [July 15, 2019, 4:58pm UTC](https://discuss.elastic.co/t/merge-2-fields-from-seperate-events-into-one-field/190587/1 "2019-07-15T16:58:55Z")

</div>

I am trying to merge the field "username" from one source (xx.xxx.xx.xx) with the field "user" from a different source (yy.yyy.yyy.yyy). I want to merge them into a new field called "User".

**Example Logs:**

[USERNAME= johndoe] [SOURCE=xx.xxx.xx.1]

user="janedoe" source=yy.yyy.yyy.111

I have tried adding a new field and deleting the "username" and "user" fields, but no luck. All it returns is

"User" =\> "%{USERNAME} janedoe"  
or  
"User" =\> "%{USERNAME} %{user}"

Conf File:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/9/a99e3d8a9b10240a625789df966221ecde01c4ae.png)

Any help is highly appreciated!!!

---

<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:** [July 15, 2019, 5:09pm UTC](https://discuss.elastic.co/t/merge-2-fields-from-seperate-events-into-one-field/190587/2 "2019-07-15T17:09:39Z")

</div>

You appear to be applying the kv filters the wrong way around.

Please do not post pictures of text. Just post the text with appropriate markdown.

---

<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:** [August 12, 2019, 5:09pm UTC](https://discuss.elastic.co/t/merge-2-fields-from-seperate-events-into-one-field/190587/3 "2019-08-12T17:09:43Z")

</div>

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