# Extract source filename in logstash received from Filebeat

**URL:** <https://discuss.elastic.co/t/extract-source-filename-in-logstash-received-from-filebeat/101108>\
**Category:** Logstash\
**Created:** [September 20, 2017, 6:35am UTC](https://discuss.elastic.co/t/extract-source-filename-in-logstash-received-from-filebeat/101108 "2017-09-20T06:35:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hasan\_sharekhan](https://avatars.discourse-cdn.com/v4/letter/h/eada6e/32.png) [@hasan\_sharekhan](https://discuss.elastic.co/u/hasan_sharekhan)\
**Post date:** [September 20, 2017, 6:35am UTC](https://discuss.elastic.co/t/extract-source-filename-in-logstash-received-from-filebeat/101108/1 "2017-09-20T06:35:30Z")

</div>

I am using ELK v5.5

How do i extract only log file name from the source log file name send by filebeat to logstash

I am processing dozens of logs files and will be having different paths and log file names, I just want to extract the file name, i.e. file name after last slash

sample log files names:

D:\uat\beats\filebeat550\input\_logs\my\_xzy\_abc\_server\my\_xyz\_abc\_server\_19Sep2017.log

/usr/logs/my\_xzy\_abc\_server/my\_xyz\_abc\_server\_19Sep2017.log

---

<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:** [September 23, 2017, 6:08pm UTC](https://discuss.elastic.co/t/extract-source-filename-in-logstash-received-from-filebeat/101108/2 "2017-09-23T18:08:58Z")

</div>

Use a grok filter. This has been asked here multiple times before so you should find examples in the archives.

---

<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 21, 2017, 6:09pm UTC](https://discuss.elastic.co/t/extract-source-filename-in-logstash-received-from-filebeat/101108/3 "2017-10-21T18:09:19Z")

</div>

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