# Can I get logstash's instance-id or hostname / node name in processing?

**URL:** <https://discuss.elastic.co/t/can-i-get-logstashs-instance-id-or-hostname-node-name-in-processing/209030>\
**Category:** Logstash\
**Created:** [November 22, 2019, 8:37am UTC](https://discuss.elastic.co/t/can-i-get-logstashs-instance-id-or-hostname-node-name-in-processing/209030 "2019-11-22T08:37:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![asp](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@asp](https://discuss.elastic.co/u/asp)\
**Post date:** [November 22, 2019, 8:37am UTC](https://discuss.elastic.co/t/can-i-get-logstashs-instance-id-or-hostname-node-name-in-processing/209030/1 "2019-11-22T08:37:18Z")

</div>

Hi,

I am runnnig logstash in kubernetes environment with identical configuration with multiple replicas as deployment.

I need to debug the lost of some message parts, so I want process the message normally (parse and send to elasticsearch) and additonally I want to save all raw events to a file. Since I believe it will not work to let 2 logstash instances write to the same file (e.g. via NFS) I thought of 1 file per logstash instance. For that filename I need a way to differ between the instances.

Thanks, Andreas

---

<div class="post-metadata">

**Author:** ![Mahesh\_Guntumadugu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mahesh_guntumadugu/32/54413_2.png) [@Mahesh\_Guntumadugu](https://discuss.elastic.co/u/Mahesh_Guntumadugu)\
**Post date:** [November 27, 2019, 5:11am UTC](https://discuss.elastic.co/t/can-i-get-logstashs-instance-id-or-hostname-node-name-in-processing/209030/2 "2019-11-27T05:11:05Z")

</div>

Try adding the following code in logstash filters, You will be able to see which node from the log is ingesting.

mutate {  
add\_field =\> { "ip\_address" =\> "%{[@metadata][ip\_address]}" }  
}

---

<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:** [December 25, 2019, 5:11am UTC](https://discuss.elastic.co/t/can-i-get-logstashs-instance-id-or-hostname-node-name-in-processing/209030/3 "2019-12-25T05:11:22Z")

</div>

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