Label individual instances of logstash through cmdline params

is there a way to label individual instances of logstash ? I run multiple logstash instances on a host and it works fine. But when I run topbeat on the host, it identifies that same proc.name for all the instances

if there was a way to label individual instances by passing in identifiers in command line params, I can atleast grok the instance name and aggregate metrics per each individual logstash instance

Currently no. I'd recommend opening an issue here GitHub - elastic/logstash: Logstash - transport and process your logs, events, or other data . It makes sense in light of our recent metrics work where we'll be adding a node name!

You can maybe get what you need using environment filter plugin.
It allows you to set a field value from an environment variable :

environment {
add_metadata_from_env { "logstash_instance" ⇒ "LOGSTASH_INSTANCE_ENV_VAR_NAME" }
}

1 Like

Thats a good idea, but I don't think it is applicable for my query. I need the nodename in the command line params, not in the logstash collector.

If i add this line in the logstash collector, it will identify the instance where these logs were collected from topbeat, not the actual node-name for which the data is collected.

That is something I did not know about thought, than you nonetheless

Created Issue #4604

OK.
So if you clearly need a marker in logstash command line (I mean command line visible using "ps"), I invite you to set "LS_JAVA_OPTS" environment variable just before calling bin/logstash.

Example :
LS_JAVA_OPTS="-Dlogstash.instance=ls1"
bin/logstash

Using this tip, your final command line that is running logstash is :
java ... -Dlogstash.instance=ls1 ...

LS_JAVA_OPTS allow you to add params to real logstash start command line.
For information, the "-Dkey=value" syntax let you to set a java system property.

This one looks more promising. let me try that.