I try to understand why every request I sent is process by my 2 logstash config file although I am using 2 differents port in my input http plugin:
Config file 1:
input {
http {
host => "0.0.0.0" # default: 0.0.0.0
port => 52001
tags => ["gps_globalsat"]
}
}
filter {
}
output {
if "gps_globalsat" in [tags] {
elasticsearch {
hosts => ['localhost:9200']
index => 'gps@elm'
document_type => '_doc'
user => 'elastic'
password => 'element'
}
}
#stdout { codec => rubydebug }
file {
codec => rubydebug
path => '/var/log/logstash/elk-gps_gsat.log'
}
}
Config file 2:
input {
http {
host => "0.0.0.0" # default: 0.0.0.0
port => 52003
tags => ["gps_osm"]
}
}
filter {
}
output {
if "gps_osm" in [tags] {
elasticsearch {
hosts => ['localhost:9200']
index => 'gps@elm'
document_type => '_doc'
user => 'elastic'
password => 'element'
}
}
#stdout { codec => rubydebug }
file {
codec => rubydebug
path => '/var/log/logstash/elk-gps_osm.log'
}
}
I can see every data inserted in elastic when checking in Kibana and the 2 differents logs file are showing the same request logs as well:
==> /var/log/logstash/elk-gps_gsat.log <==
{ "@timestamp" => 2018-10-17T00:18:42.000Z, "type" => "push", "host" => "127.0.0.1", "tags" => [ [0] "gps_globalsat" ], "@version" => "1", "report" => "82", "customer" => "elm", "rx" => { "gwrx" => [ [0] { "lsnr" => -8.8, "time" => "2018-10-17 11:18:42", "chan" => 1, "rssi" => -119, "rfch" => 0 } ], "moteeui" => "665365B", "userdata" => { "motetx" => { "modu" => "LoRa", "codr" => "4/5", "datr" => "SF12BW125", "freq" => 868300000 }, "seqno" => 36, "port" => 2, "payload" => "MDA4MjU0ZmVhYzI2NDAwOWViYWFmOQ==" } }, "battery" => 84, "client" => "element", "activite" => "tracking", "location" => { "lat" => -22.272447, "lon" => 166.439673 } }
==> /var/log/logstash/elk-gps_osm.log <==
{ "@timestamp" => 2018-10-17T00:18:42.000Z, "type" => "push", "host" => "127.0.0.1", "tags" => [ [0] "gps_globalsat" ], "@version" => "1", "report" => "82", "customer" => "elm", "rx" => { "gwrx" => [ [0] { "lsnr" => -8.8, "time" => "2018-10-17 11:18:42", "chan" => 1, "rssi" => -119, "rfch" => 0 } ], "moteeui" => "665365B", "userdata" => { "motetx" => { "modu" => "LoRa", "codr" => "4/5", "datr" => "SF12BW125", "freq" => 868300000 }, "seqno" => 36, "port" => 2, "payload" => "MDA4MjU0ZmVhYzI2NDAwOWViYWFmOQ==" } }, "battery" => 84, "client" => "element", "activite" => "tracking", "location" => { "lat" => -22.272447, "lon" => 166.439673 } }