# Label individual instances of logstash through cmdline params

**URL:** <https://discuss.elastic.co/t/label-individual-instances-of-logstash-through-cmdline-params/40513>\
**Category:** Logstash\
**Created:** [January 29, 2016, 7:02pm UTC](https://discuss.elastic.co/t/label-individual-instances-of-logstash-through-cmdline-params/40513 "2016-01-29T19:02:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![biswajit86](https://avatars.discourse-cdn.com/v4/letter/b/f17d59/32.png) [@biswajit86](https://discuss.elastic.co/u/biswajit86)\
**Post date:** [January 29, 2016, 7:02pm UTC](https://discuss.elastic.co/t/label-individual-instances-of-logstash-through-cmdline-params/40513/1 "2016-01-29T19:02:38Z")

</div>

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](http://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

---

<div class="post-metadata">

**Author:** ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)\
**Post date:** [January 29, 2016, 10:41pm UTC](https://discuss.elastic.co/t/label-individual-instances-of-logstash-through-cmdline-params/40513/2 "2016-01-29T22:41:28Z")

</div>

> [@biswajit86](#):
>
> label

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

---

<div class="post-metadata">

**Author:** ![fbaligand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fbaligand/32/5657_2.png) [@fbaligand](https://discuss.elastic.co/u/fbaligand)\
**Post date:** [January 30, 2016, 11:43pm UTC](https://discuss.elastic.co/t/label-individual-instances-of-logstash-through-cmdline-params/40513/3 "2016-01-30T23:43:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![biswajit86](https://avatars.discourse-cdn.com/v4/letter/b/f17d59/32.png) [@biswajit86](https://discuss.elastic.co/u/biswajit86)\
**Post date:** [February 1, 2016, 6:26pm UTC](https://discuss.elastic.co/t/label-individual-instances-of-logstash-through-cmdline-params/40513/4 "2016-02-01T18:26:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![biswajit86](https://avatars.discourse-cdn.com/v4/letter/b/f17d59/32.png) [@biswajit86](https://discuss.elastic.co/u/biswajit86)\
**Post date:** [February 1, 2016, 6:37pm UTC](https://discuss.elastic.co/t/label-individual-instances-of-logstash-through-cmdline-params/40513/5 "2016-02-01T18:37:57Z")

</div>

Created [Issue #4604](https://github.com/elastic/logstash/issues/4604)

---

<div class="post-metadata">

**Author:** ![fbaligand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fbaligand/32/5657_2.png) [@fbaligand](https://discuss.elastic.co/u/fbaligand)\
**Post date:** [February 1, 2016, 10:14pm UTC](https://discuss.elastic.co/t/label-individual-instances-of-logstash-through-cmdline-params/40513/6 "2016-02-01T22:14:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![biswajit86](https://avatars.discourse-cdn.com/v4/letter/b/f17d59/32.png) [@biswajit86](https://discuss.elastic.co/u/biswajit86)\
**Post date:** [February 2, 2016, 8:25pm UTC](https://discuss.elastic.co/t/label-individual-instances-of-logstash-through-cmdline-params/40513/7 "2016-02-02T20:25:26Z")

</div>

This one looks more promising. let me try that.

---

<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:** [July 6, 2017, 5:13am UTC](https://discuss.elastic.co/t/label-individual-instances-of-logstash-through-cmdline-params/40513/8 "2017-07-06T05:13:20Z")

</div>

Closed on July 6, 2017, 5:13am UTC


