# Defining Source When Using Filebeat

**URL:** <https://discuss.elastic.co/t/defining-source-when-using-filebeat/249877>\
**Category:** Logstash\
**Created:** [September 24, 2020, 8:22pm UTC](https://discuss.elastic.co/t/defining-source-when-using-filebeat/249877 "2020-09-24T20:22:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![teej](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@teej](https://discuss.elastic.co/u/teej)\
**Post date:** [September 24, 2020, 8:22pm UTC](https://discuss.elastic.co/t/defining-source-when-using-filebeat/249877/1 "2020-09-24T20:22:05Z")

</div>

Hi,  
I am using filebeat to read xml files from a directory and then feed it to logstash where it is filetered then sent out to elastic. I thought that perhaps when the pipeline gets created in the logstash config, it does the filebeat input and then passes it to the filter portion but perhaps not cause when I run the job I get:

```
  filter {
    xml {
      source => # SETTING MISSING
      ...
    }
  }

```

My current config has:

```
input {
  beats {
    port => 5044
    codec => multiline {
      auto_flush_interval => 1
      negate => "true"
      pattern => "^<name=*\>"
      what => "previous"
      max_lines => 1000000000
      max_bytes => "500 MiB"}}
  }
filter {
  xml {
      store_xml => true
      store_xml => false
      target => "theXML"
      force_array => false
    }
  mutate { replace => { "c_port" => "%{[theXML][c_port]}" } }
  mutate { convert => { "c_port" => "integer" } }}

```

So Im curious if its not logically reading from input as SOURCE and I have to place A SOURCE statment in the filter section then what do I declare as the source? Would it be something like:

`SOURCE => beats`

?

Thank you.

---

<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:** [September 24, 2020, 9:00pm UTC](https://discuss.elastic.co/t/defining-source-when-using-filebeat/249877/2 "2020-09-24T21:00:31Z")

</div>

You need to tell the xml filter which field of the event the XML is in. You can try

```
source => "message"

```

> ```
> store_xml => true
> store_xml => false
> 
> ```

If you set store\_xml to false and are not using xpath then the xml filter will not do anything.

---

<div class="post-metadata">

**Author:** ![teej](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@teej](https://discuss.elastic.co/u/teej)\
**Post date:** [September 30, 2020, 4:32pm UTC](https://discuss.elastic.co/t/defining-source-when-using-filebeat/249877/3 "2020-09-30T16:32:08Z")

</div>

Thank you Badger. Really appreciate you being out there for us little folks.

---

<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:** [October 28, 2020, 4:32pm UTC](https://discuss.elastic.co/t/defining-source-when-using-filebeat/249877/4 "2020-10-28T16:32:27Z")

</div>

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