What is the purpose of setting "thread" value in heartbeat plugin?

Hi Team,

[Using Logstash version: 6.4.1]

I have some queries regarding heartbeat plugin.

I have configured heartbeat plugin with "threads" parameter, as per the specification mentioned on elastic official site, Kindly refer to below URL for the reference:

URL:
https://www.elastic.co/guide/en/logstash/6.4/plugins-inputs-heartbeat.html#plugins-inputs-heartbeat-threads

The default value for threads parameter is 1 as mentioned in above URL.

While setting the value for threads parameter to N (N= 1, 2, 3 ..... any number), N number of
threads for heartbeat messages are being created, in other words N similar (duplicate) heartbeat messages are being created.

Below is the snippet of logstash.conf and debug log.

=============logstash.conf====================

input {
heartbeat {
message => "Logstash works properly"
threads => 2
}
}
output {
stdout {}
}
============================================

================Output of Logstash debug logs================

[2019-06-24T10:05:34,705][DEBUG][logstash.pipeline ] filter received {"event"=>{"message"=>"Logstash works properly", "@timestamp"=>2019-06-24T04:35:34.564Z, "host"=>"node1", "@version"=>"1"}}
[2019-06-24T10:05:34,706][DEBUG][logstash.pipeline ] filter received {"event"=>{"message"=>"Logstash works properly", "@timestamp"=>2019-06-24T04:35:34.599Z, "host"=>"node1", "@version"=>"1"}}
[2019-06-24T10:05:34,710][DEBUG][logstash.pipeline ] output received {"event"=>{"message"=>"Logstash works properly", "@timestamp"=>2019-06-24T04:35:34.532Z, "host"=>"node1", "@version"=>"1"}}
[2019-06-24T10:05:34,715][DEBUG][logstash.pipeline ] output received {"event"=>{"message"=>"Logstash works properly", "@timestamp"=>2019-06-24T04:35:34.536Z, "host"=>"node1", "@version"=>"1"}}
=============================================

But I am not getting the clarity on below points, as no much information is given in official documents.

I am not getting the exact scenario or deployment where Logstash heartbeat plugin can be used while setting threads parameter to 2 or even more, in other words, What is the purpose of setting the "threads" value 2 or more than 2 ?

Regards,
Garima

The threads option gets inheritied from the threadable class, which the heartbeat input is based on. Setting it to more than 1 'is the same as declaring the input multiple times'. The only use I can think of is if you want a higher message rate than a single thread can produce.

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