# Dynamical way of getting name and path of Logstash config file

**URL:** <https://discuss.elastic.co/t/dynamical-way-of-getting-name-and-path-of-logstash-config-file/324324>\
**Category:** Logstash\
**Created:** [January 31, 2023, 12:22pm UTC](https://discuss.elastic.co/t/dynamical-way-of-getting-name-and-path-of-logstash-config-file/324324 "2023-01-31T12:22:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sigbo](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@sigbo](https://discuss.elastic.co/u/sigbo)\
**Post date:** [January 31, 2023, 12:22pm UTC](https://discuss.elastic.co/t/dynamical-way-of-getting-name-and-path-of-logstash-config-file/324324/1 "2023-01-31T12:22:23Z")

</div>

We have a lot of Logstash configuration files and some handle almost the same data. Along with Logstash we have several other scripts ingesting data into Elasticsearch.

Because of the sheer amount, we'd like to be able to track them. Our idea is to add some fields in the logs describing where they "come from".

I've found a way to get the server that the Logstash instance is running on from within the configuration file. [How can I get the logstash hostname](https://discuss.elastic.co/t/how-can-i-get-the-logstash-hostname/51771)

What I'm missing is a dynamical way to get the name and path of the config file. As an example:  
file = my-config.conf  
path = /path/to/my/conf/

Hope you can help, so we don't have to hardcode anything.

---

<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:** [February 28, 2023, 12:23pm UTC](https://discuss.elastic.co/t/dynamical-way-of-getting-name-and-path-of-logstash-config-file/324324/2 "2023-02-28T12:23:15Z")

</div>

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