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

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

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]}" }
}