# Want to Combine Field Values into New Field Value

**URL:** https://discuss.elastic.co/t/want-to-combine-field-values-into-new-field-value/28564
**Category:** Logstash
**Created:** [September 2, 2015, 10:37pm UTC](https://discuss.elastic.co/t/want-to-combine-field-values-into-new-field-value/28564 "2015-09-02T22:37:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![bhutchinson](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@bhutchinson](https://discuss.elastic.co/u/bhutchinson)
#### Post date: [September 2, 2015, 10:37pm UTC](https://discuss.elastic.co/t/want-to-combine-field-values-into-new-field-value/28564/1 "2015-09-02T22:37:45Z")

</div>

The useragent filter creates new field names in elasticsearch like "name", "major version", "minor version". Name is the browser name. Major version is the browser major version. Minor is the browser minor version.

I want to create a new field named "browser" that is a combination (conctenation) of the field values from name, major version, and minor version.

Example  
My new "browser" field might have a value of "Internet Explorer 10.0", or "Google Chrome XX.X" or "Firefox XX.X"

What filter do I need to write in my logstash.conf to create the new "browser" field and populate the "browser" field with the concatenated value?

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [September 3, 2015, 3:41am UTC](https://discuss.elastic.co/t/want-to-combine-field-values-into-new-field-value/28564/2 "2015-09-03T03:41:41Z")

</div>

```
mutate {
  add_field => {
    "new_field" => "%{oldfield1} %{oldfield2}"
  }
  remove_field => ["oldfield1", "oldfield"]
}

```

This assumes that `add_field` is evaluated before `remove_field` but I'm pretty sure that's the case.

---

<div class="post-metadata">

### Author: ![bhutchinson](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@bhutchinson](https://discuss.elastic.co/u/bhutchinson)
#### Post date: [September 3, 2015, 2:00pm UTC](https://discuss.elastic.co/t/want-to-combine-field-values-into-new-field-value/28564/3 "2015-09-03T14:00:02Z")

</div>

How do I add a period between the "major version" value and the "minor version" value?

I want to concatenate 3 fields into on field value. The new field will contain the 3 field values along with one space and one period.

Example  
browser name (space) major version (period) minor version  
Internet Explorer 10.0  
Internet Explorer 9.0  
Google Chrome XX.X  
Mozilla Firefox XX.X

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [September 3, 2015, 2:06pm UTC](https://discuss.elastic.co/t/want-to-combine-field-values-into-new-field-value/28564/4 "2015-09-03T14:06:08Z")

</div>

The "%{oldfield1} %{oldfield2}" string above is a template where %{oldfield} will be replaced with the contents of the oldfield field. The rest of the string will be untouched. Hence, if you want a period between the two field values just put a period instead of a space. Such strings can also include more than two field references.

---

<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: [July 6, 2017, 5:30am UTC](https://discuss.elastic.co/t/want-to-combine-field-values-into-new-field-value/28564/5 "2017-07-06T05:30:14Z")

</div>


