# How to handle message with \<F1\>value\</F1\>\<F3\>value\</F3\>

**URL:** <https://discuss.elastic.co/t/how-to-handle-message-with-f1-value-f1-f3-value-f3/178521>\
**Category:** Logstash\
**Created:** [April 25, 2019, 6:44pm UTC](https://discuss.elastic.co/t/how-to-handle-message-with-f1-value-f1-f3-value-f3/178521 "2019-04-25T18:44:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rugenl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rugenl/32/12887_2.png) [@rugenl](https://discuss.elastic.co/u/rugenl)\
**Post date:** [April 25, 2019, 6:44pm UTC](https://discuss.elastic.co/t/how-to-handle-message-with-f1-value-f1-f3-value-f3/178521/1 "2019-04-25T18:44:39Z")

</div>

We have some logs where fields are separated with html like tags, value or phrase. The problem is that some messages have different fields and/or they may be in different orders.

Our SME's assistance was "Splunk just did it"

Thanks

---

<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 25, 2019, 7:47pm UTC](https://discuss.elastic.co/t/how-to-handle-message-with-f1-value-f1-f3-value-f3/178521/2 "2019-04-25T19:47:02Z")

</div>

You can use an xml filter to parse that. A filter can only consume one XML document at a time, so you would need to wrap it in an outer document. With that message

```
    mutate { gsub => ["message", "^", "<f>", "message", "$", "</f>"] }
    xml { source => "message" target => "theXML" }

```

would result in

```
    "theXML" => {
    "F1" => [
        [0] "value"
    ],
    "F3" => [
        [0] "value"
    ]
}

```

You may also want to use the option force\_array =\> false.

---

<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 23, 2019, 7:47pm UTC](https://discuss.elastic.co/t/how-to-handle-message-with-f1-value-f1-f3-value-f3/178521/3 "2019-05-23T19:47:11Z")

</div>

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