# \[Solved\] Question about a filter

**URL:** https://discuss.elastic.co/t/solved-question-about-a-filter/50939
**Category:** Logstash
**Created:** [May 25, 2016, 1:01pm UTC](https://discuss.elastic.co/t/solved-question-about-a-filter/50939 "2016-05-25T13:01:50Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Uros\_Meglic](https://avatars.discourse-cdn.com/v4/letter/u/edb3f5/32.png) [@Uros\_Meglic](https://discuss.elastic.co/u/Uros_Meglic)
#### Post date: [May 25, 2016, 1:01pm UTC](https://discuss.elastic.co/t/solved-question-about-a-filter/50939/1 "2016-05-25T13:01:50Z")

</div>

Hello,

just a quick question. What is the best filter for this type of logs:

I figured I would make a grok pattern, but I would just like to check if there is a better option, since the log is always formed as variablename="value".

Thanks and kind regards,

Uros

---

<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: [May 25, 2016, 1:21pm UTC](https://discuss.elastic.co/t/solved-question-about-a-filter/50939/2 "2016-05-25T13:21:35Z")

</div>

What type of logs? The example disappeared from your post. You probably need to format it as code with the `</>` button.

---

<div class="post-metadata">

### Author: ![Uros\_Meglic](https://avatars.discourse-cdn.com/v4/letter/u/edb3f5/32.png) [@Uros\_Meglic](https://discuss.elastic.co/u/Uros_Meglic)
#### Post date: [May 31, 2016, 7:42am UTC](https://discuss.elastic.co/t/solved-question-about-a-filter/50939/3 "2016-05-31T07:42:07Z")

</div>

Hello,

it is supposed to be some proprietary xml format.

```
<data dt="2016-05-30 15:22:32" dtms="1464614552064" export="DATA_Network_Publisher" lang="en_US" id="1334660750794560311" guid="54334db0-bdb5-11f4-49d4-bb9b10dd8e4d" path="&#47;Main group" name="0_DATA Network" type="Structuring model" typeGuid="" origType="Structuring model" userId="345234" userGuid="9b6d0bb3-102b-37fa-a57b-c4a39149518e" />
<data dt="2016-05-30 15:23:36" dtms="1464614616896" export="DATA_Network_Publisher" lang="en_US" id="1334660750794560311" guid="54334db0-bdb5-11f4-49d4-bb9b10dd8e4d" path="&#47;Main group" name="0_DATA Network" type="Structuring model" typeGuid="" origType="Structuring model" userId="345234" userGuid="9b6d0bb3-102b-37fa-a57b-c4a39149518e" />
<data dt="2016-05-30 15:23:40" dtms="1464614620303" export="DATA_Network_Publisher" lang="en_US" id="1334660750794560311" guid="54334db0-bdb5-11f4-49d4-bb9b10dd8e4d" path="&#47;Main group" name="0_DATA Network" type="Structuring model" typeGuid="" origType="Structuring model" userId="345234" userGuid="9b6d0bb3-102b-37fa-a57b-c4a39149518e" />
```

---

<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: [May 31, 2016, 7:53am UTC](https://discuss.elastic.co/t/solved-question-about-a-filter/50939/4 "2016-05-31T07:53:19Z")

</div>

Use the xml filter.

---

<div class="post-metadata">

### Author: ![purbon](https://avatars.discourse-cdn.com/v4/letter/p/edb3f5/32.png) [@purbon](https://discuss.elastic.co/u/purbon)
#### Post date: [May 31, 2016, 10:11am UTC](https://discuss.elastic.co/t/solved-question-about-a-filter/50939/5 "2016-05-31T10:11:44Z")

</div>

Hi,  
what @magnusbaeck just said :-P, a config like

```auto
filter {
  xml {
    source => "message"
    target => "foo"
  }
}

```

for the filter section would be enough, keep in mind to add the target field otherwise strange errors might show up. see [https://github.com/logstash-plugins/logstash-filter-xml/issues/37](https://github.com/logstash-plugins/logstash-filter-xml/issues/37)

---

<div class="post-metadata">

### Author: ![Uros\_Meglic](https://avatars.discourse-cdn.com/v4/letter/u/edb3f5/32.png) [@Uros\_Meglic](https://discuss.elastic.co/u/Uros_Meglic)
#### Post date: [May 31, 2016, 10:27am UTC](https://discuss.elastic.co/t/solved-question-about-a-filter/50939/6 "2016-05-31T10:27:36Z")

</div>

Hey all,

perfect. I already tried to use the xml filter and it didn´t work. It looks like I made some config error (probably overcomplicated things), because with this minimal config it is working perfectly. 🙂

Thanks and kind regards,

Uros

---

<div class="post-metadata">

### Author: ![Uros\_Meglic](https://avatars.discourse-cdn.com/v4/letter/u/edb3f5/32.png) [@Uros\_Meglic](https://discuss.elastic.co/u/Uros_Meglic)
#### Post date: [May 31, 2016, 11:32am UTC](https://discuss.elastic.co/t/solved-question-about-a-filter/50939/7 "2016-05-31T11:32:42Z")

</div>

Just a quick question regarding the target field. Now the parsed data looks like:  
target.field = value

Is it possible to parse xml data to the top level? I don't know how to explain. I would like to have the field name on the top "level".

Kind regards,  
Uros

---

<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, 4:55am UTC](https://discuss.elastic.co/t/solved-question-about-a-filter/50939/8 "2017-07-06T04:55:17Z")

</div>


