# Get Name of a file in parent directory and put it into a field

**URL:** <https://discuss.elastic.co/t/get-name-of-a-file-in-parent-directory-and-put-it-into-a-field/159534>\
**Category:** Logstash\
**Created:** [December 5, 2018, 12:45pm UTC](https://discuss.elastic.co/t/get-name-of-a-file-in-parent-directory-and-put-it-into-a-field/159534 "2018-12-05T12:45:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbienert](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@sbienert](https://discuss.elastic.co/u/sbienert)\
**Post date:** [December 5, 2018, 12:45pm UTC](https://discuss.elastic.co/t/get-name-of-a-file-in-parent-directory-and-put-it-into-a-field/159534/1 "2018-12-05T12:45:55Z")

</div>

Hello,  
I want to retrieve the name of a (the only) .jar file in the parent folder of a directory which is already named in the source field because the log came through filebeat.

So my /path/to/application/ looks like this:  
logs/ app\_name.jar

Inside the logs folder are the logs located that are fetched by filebeat. Now I want to have new field called "application" which has for the given example "app\_name" as a value.

I know this is a pretty special requirement but who know, maybe this is possible.

Thank you

---

<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:** [January 2, 2019, 12:45pm UTC](https://discuss.elastic.co/t/get-name-of-a-file-in-parent-directory-and-put-it-into-a-field/159534/2 "2019-01-02T12:45:59Z")

</div>

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