# I want to combine field

**URL:** <https://discuss.elastic.co/t/i-want-to-combine-field/268300>\
**Category:** Logstash\
**Created:** [March 25, 2021, 7:47am UTC](https://discuss.elastic.co/t/i-want-to-combine-field/268300 "2021-03-25T07:47:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlackCat](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@BlackCat](https://discuss.elastic.co/u/BlackCat)\
**Post date:** [March 25, 2021, 7:47am UTC](https://discuss.elastic.co/t/i-want-to-combine-field/268300/1 "2021-03-25T07:47:23Z")

</div>

I want to new create "Message" field by "Thread" + "Loglevel" + "Content".  
Please teach me how to do it.

Raw log.

```auto
[13172] [INFO] 2021-03-25 09:18:21.150 +0900 : Java class name: org.apache.catalina.startup.Bootstrap; Method name: main; Arguments: start

```

I use below grok.

```auto
%{NOTSPACE:Thread} %{NOTSPACE:Loglevel} %{TIMESTAMP_ISO8601:Time} %{ISO8601_TIMEZONE} %{GREEDYDATA:Content}

```

Structured Data.

```auto
{
  "Loglevel": "[INFO]",
  "Content": ": Java class name: org.apache.catalina.startup.Bootstrap; Method name: main; Arguments: start",
  "Time": "2021-03-25 09:18:21.150",
  "Thread": "[13172]"
}

```

---

<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:** [March 25, 2021, 5:50pm UTC](https://discuss.elastic.co/t/i-want-to-combine-field/268300/2 "2021-03-25T17:50:47Z")

</div>

You can create a field using sprintf references

```
mutate { replace => { "message" => "%{Thread} %{Loglevel} %{Content}" } }
```

---

<div class="post-metadata">

**Author:** ![BlackCat](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@BlackCat](https://discuss.elastic.co/u/BlackCat)\
**Post date:** [March 26, 2021, 1:46am UTC](https://discuss.elastic.co/t/i-want-to-combine-field/268300/3 "2021-03-26T01:46:38Z")

</div>

Thank you for your reply.

I thought same your solution.  
Cause is above "else if" part and I replaced.  
I use file name in "else if".

It work.

---

<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:** [April 23, 2021, 1:47am UTC](https://discuss.elastic.co/t/i-want-to-combine-field/268300/4 "2021-04-23T01:47:15Z")

</div>

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