# How to extract fields from "message" field in logstash?

**URL:** <https://discuss.elastic.co/t/how-to-extract-fields-from-message-field-in-logstash/302470>\
**Category:** Logstash\
**Created:** [April 14, 2022, 8:48pm UTC](https://discuss.elastic.co/t/how-to-extract-fields-from-message-field-in-logstash/302470 "2022-04-14T20:48:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaonyO](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@RaonyO](https://discuss.elastic.co/u/RaonyO)\
**Post date:** [April 14, 2022, 8:48pm UTC](https://discuss.elastic.co/t/how-to-extract-fields-from-message-field-in-logstash/302470/1 "2022-04-14T20:48:06Z")

</div>

hello, I need help in extracting the fields that come in the "message" field, in case all the fields need to be extracted, can anyone help?

here's the field:

```auto
"message": "Apr 14 16:11:36 tutorial2022-1 sshd[8454]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=xx.xxx.xxx.xx user=root"

```

---

<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:** [April 14, 2022, 9:15pm UTC](https://discuss.elastic.co/t/how-to-extract-fields-from-message-field-in-logstash/302470/2 "2022-04-14T21:15:44Z")

</div>

Use a [kv](https://www.elastic.co/guide/en/logstash/current/plugins-filters-kv.html) filter.

```
kv { allow_empty_values => true whitespace => strict }

```

will produce

```
       "uid" => "0",
     "rhost" => "xx.xxx.xxx.xx",
      "euid" => "0",
     "ruser" => "",
   "logname" => "",
       "tty" => "ssh",
      "user" => "root",
```

---

<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:** [May 12, 2022, 9:16pm UTC](https://discuss.elastic.co/t/how-to-extract-fields-from-message-field-in-logstash/302470/3 "2022-05-12T21:16:16Z")

</div>

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