# How to read the log file in a path using regular expression in filebeat

**URL:** <https://discuss.elastic.co/t/how-to-read-the-log-file-in-a-path-using-regular-expression-in-filebeat/286377>\
**Category:** Beats\
**Tags:** beats-module, filebeat\
**Created:** [October 11, 2021, 2:58pm UTC](https://discuss.elastic.co/t/how-to-read-the-log-file-in-a-path-using-regular-expression-in-filebeat/286377 "2021-10-11T14:58:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![muralikrishna](https://avatars.discourse-cdn.com/v4/letter/m/8e7dd6/32.png) [@muralikrishna](https://discuss.elastic.co/u/muralikrishna)\
**Post date:** [October 11, 2021, 2:58pm UTC](https://discuss.elastic.co/t/how-to-read-the-log-file-in-a-path-using-regular-expression-in-filebeat/286377/1 "2021-10-11T14:58:55Z")

</div>

Hello Everyone,

I have stuck with an issue to collect/read the logs from a path using regular expression using filebeat. Could some one help me with my issue.

Context: I have some servers where the logs are being written by an application but the path is not common in all the servers (server count \> 500)

Path in different servers looks like:  
Server 1 = /Application/admin/\<_ **\>/\<** _\>/\<_**\>/trace/app.log  
Server 2 = /Application/admin/\< **_\>/\<_** \>/\<**_\>/trace/app.log  
Server 3 = \<_ **\>/Application/admin/\<** _\>/\<_ **\>/\<** _\>/trace/app.log  
Server 4 = \<_ **\>/\<** _\>/Application/admin/\<_ **\>/\<** _\>/\<\*\*\*\>/trace/app.log

Common thing in all the servers is the ending directories "/trace/app.log" and also the middle directory path "application/admin".

In this case, if i have to use a common filebeat.yml configuration, I think we can use a regular expression to read the log file commonly from all the servers.

Can someone help me with the required reg expressions which can work in my scenario. Thanks in Advance 🙂

---

<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:** [November 8, 2021, 4:59pm UTC](https://discuss.elastic.co/t/how-to-read-the-log-file-in-a-path-using-regular-expression-in-filebeat/286377/2 "2021-11-08T16:59:33Z")

</div>

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