# Logstash parser to read multiple files through input and process

**URL:** <https://discuss.elastic.co/t/logstash-parser-to-read-multiple-files-through-input-and-process/175943>\
**Category:** Logstash\
**Created:** [April 9, 2019, 3:42am UTC](https://discuss.elastic.co/t/logstash-parser-to-read-multiple-files-through-input-and-process/175943 "2019-04-09T03:42:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tkb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tkb/32/43684_2.png) [@tkb](https://discuss.elastic.co/u/tkb)\
**Post date:** [April 9, 2019, 3:42am UTC](https://discuss.elastic.co/t/logstash-parser-to-read-multiple-files-through-input-and-process/175943/1 "2019-04-09T03:42:48Z")

</div>

Hi -

I've testng xml file contains testcaseName, status(pass/fail), error Desc, etc

And have another file jenkins.txt contains only one value jenkinBuildNumber=35

Now my requirement is to read these 2 files and add build number on every testcases. And write into mongodb.

## Required Output

testcaseName| status| Error Desc| jenkinBuildNumber

Plz help how can I get this expected output.

Thanks in advance !!!

---

<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 9, 2019, 11:50am UTC](https://discuss.elastic.co/t/logstash-parser-to-read-multiple-files-through-input-and-process/175943/2 "2019-04-09T11:50:44Z")

</div>

You can parse the XML with an [xml](https://www.elastic.co/guide/en/logstash/current/plugins-filters-xml.html) filter.

If you can change the format of the other file to be a csv (jenkinBuildNumber,35) then you could retrieve that use a [translate](https://www.elastic.co/guide/en/logstash/current/plugins-filters-translate.html) filter with a constant key.

```
    mutate { add_field => { "[@metadata][key]" => "jenkinBuildNumber" } }
    translate { dictionary_path => "/home/user/foo.csv" field => "[@metadata][key]" destination => "buildNumber" }
```

---

<div class="post-metadata">

**Author:** ![tkb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tkb/32/43684_2.png) [@tkb](https://discuss.elastic.co/u/tkb)\
**Post date:** [April 9, 2019, 12:46pm UTC](https://discuss.elastic.co/t/logstash-parser-to-read-multiple-files-through-input-and-process/175943/3 "2019-04-09T12:46:26Z")

</div>

Many Thanks Badger...Its perfectly working.

 ![Image](https://us1.discourse-cdn.com/elastic/original/3X/1/3/13302a09755d6400df80e9a409a1c3fae6d2cfbd.png)

---

<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 7, 2019, 12:46pm UTC](https://discuss.elastic.co/t/logstash-parser-to-read-multiple-files-through-input-and-process/175943/4 "2019-05-07T12:46:40Z")

</div>

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