# How to check logstash have listen snmptrap?

**URL:** <https://discuss.elastic.co/t/how-to-check-logstash-have-listen-snmptrap/44530>\
**Category:** Logstash\
**Created:** [March 16, 2016, 9:06am UTC](https://discuss.elastic.co/t/how-to-check-logstash-have-listen-snmptrap/44530 "2016-03-16T09:06:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefansaye](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@stefansaye](https://discuss.elastic.co/u/stefansaye)\
**Post date:** [March 16, 2016, 9:06am UTC](https://discuss.elastic.co/t/how-to-check-logstash-have-listen-snmptrap/44530/1 "2016-03-16T09:06:24Z")

</div>

I am a new to lostash and elastichsearch. I want to collection logs of network devices by snmptrap. I have a problem with logstash.

+snmptrapd.conf  
authCommunity log,net public  
forward default localhost:1062

+logstash-snmptrap.conf

input {  
snmptrap {  
community =\> "public"  
port =\> 1062  
type =\> "snmp\_trap"  
}  
}

output {  
if [type] == "snmp\_trap" {  
file {  
codec =\> "rubydebug"  
flush\_interval =\> 1  
path =\> "/tmp/logstash-snmptrap.log"  
}  
}  
}

Is there any issue with the configuration ? Netstat output as follows,  
udp 0 0 0.0.0.0:162 0.0.0.0:\*  
udp6 0 0 :::1062 :::\* 10771/java

I didn't get any error msg when i execute the command as follows,  
root@pc:~# /opt/logstash/bin/logstash -f /etc/logstash/conf.d/logstash- snmptrap.conf -v --debug --verbose

Settings: Default filter workers: 1  
It's a Trap! {:Port=\>1062, :Community=\>["public"], :Host=\>"0.0.0.0", :level=\>:info}  
Using mapping template from {:path=\>nil, :level=\>:info}  
Attempting to install template {:manage\_template=\>{"template"=\>"logstash-_", "settings"=\>{"index.refresh\_interval"=\>"5s"}, "mappings"=\>{"default"=\>{"\_all"=\>{"enabled"=\>true, "omit\_norms"=\>true}, "dynamic\_templates"=\>[{"message\_field"=\>{"match"=\>"message", "match\_mapping\_type"=\>"string", "mapping"=\>{"type"=\>"string", "index"=\>"analyzed", "omit\_norms"=\>true, "fielddata"=\>{"format"=\>"disabled"}}}}, {"string\_fields"=\>{"match"=\>"_", "match\_mapping\_type"=\>"string", "mapping"=\>{"type"=\>"string", "index"=\>"analyzed", "omit\_norms"=\>true, "fielddata"=\>{"format"=\>"disabled"}, "fields"=\>{"raw"=\>{"type"=\>"string", "index"=\>"not\_analyzed", "doc\_values"=\>true, "ignore\_above"=\>256}}}}}, {"float\_fields"=\>{"match"=\>"_", "match\_mapping\_type"=\>"float", "mapping"=\>{"type"=\>"float", "doc\_values"=\>true}}}, {"double\_fields"=\>{"match"=\>"_", "match\_mapping\_type"=\>"double", "mapping"=\>{"type"=\>"double", "doc\_values"=\>true}}}, {"byte\_fields"=\>{"match"=\>"_", "match\_mapping\_type"=\>"byte", "mapping"=\>{"type"=\>"byte", "doc\_values"=\>true}}}, {"short\_fields"=\>{"match"=\>"_", "match\_mapping\_type"=\>"short", "mapping"=\>{"type"=\>"short", "doc\_values"=\>true}}}, {"integer\_fields"=\>{"match"=\>"_", "match\_mapping\_type"=\>"integer", "mapping"=\>{"type"=\>"integer", "doc\_values"=\>true}}}, {"long\_fields"=\>{"match"=\>"_", "match\_mapping\_type"=\>"long", "mapping"=\>{"type"=\>"long", "doc\_values"=\>true}}}, {"date\_fields"=\>{"match"=\>"_", "match\_mapping\_type"=\>"date", "mapping"=\>{"type"=\>"date", "doc\_values"=\>true}}}, {"geo\_point\_fields"=\>{"match"=\>"_", "match\_mapping\_type"=\>"geo\_point", "mapping"=\>{"type"=\>"geo\_point", "doc\_values"=\>true}}}], "properties"=\>{"@timestamp"=\>{"type"=\>"date", "doc\_values"=\>true}, "@version"=\>{"type"=\>"string", "index"=\>"not\_analyzed", "doc\_values"=\>true}, "geoip"=\>{"type"=\>"object", "dynamic"=\>true, "properties"=\>{"ip"=\>{"type"=\>"ip", "doc\_values"=\>true}, "location"=\>{"type"=\>"geo\_point", "doc\_values"=\>true}, "latitude"=\>{"type"=\>"float", "doc\_values"=\>true}, "longitude"=\>{"type"=\>"float", "doc\_values"=\>true}}}}}}}, :level=\>:info}  
New Elasticsearch output {:class=\>"LogStash::Outputs::ElasticSearch", :hosts=\>["localhost"], :level=\>:info}  
Pipeline started {:level=\>:info}  
Logstash startup completed

but I can't find the file "/tmp/logstash-snmptrap.log" , what's wrong with my logstash config ?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [March 16, 2016, 9:19am UTC](https://discuss.elastic.co/t/how-to-check-logstash-have-listen-snmptrap/44530/2 "2016-03-16T09:19:25Z")

</div>

It seems you're not running the configuration you think you're running. According to the log you have an elasticsearch output in your configuration.

---

<div class="post-metadata">

**Author:** ![stefansaye](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@stefansaye](https://discuss.elastic.co/u/stefansaye)\
**Post date:** [March 17, 2016, 1:47am UTC](https://discuss.elastic.co/t/how-to-check-logstash-have-listen-snmptrap/44530/3 "2016-03-17T01:47:18Z")

</div>

Is it wrong with my config ?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [March 17, 2016, 6:26am UTC](https://discuss.elastic.co/t/how-to-check-logstash-have-listen-snmptrap/44530/4 "2016-03-17T06:26:30Z")

</div>

The configuration you _posted_ looks correct, but the log from what you _ran_ indicates a different configuration. It clearly shows that you had an elasticsearch output but the configuration you posted didn't contain any elasticsearch outputs.

---

<div class="post-metadata">

**Author:** ![LetMeR00t](https://avatars.discourse-cdn.com/v4/letter/l/9de0a6/32.png) [@LetMeR00t](https://discuss.elastic.co/u/LetMeR00t)\
**Post date:** [March 24, 2016, 1:04pm UTC](https://discuss.elastic.co/t/how-to-check-logstash-have-listen-snmptrap/44530/5 "2016-03-24T13:04:16Z")

</div>

I don't know if you have copy your command line (well I think so) but :

> root@pc:~# /opt/logstash/bin/logstash -f /etc/logstash/conf.d/logstash- snmptrap.conf -v --debug --verbose

contains a space between "logstash-" and "snmptrap.conf", maybe the mistake ?

---

<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:05am UTC](https://discuss.elastic.co/t/how-to-check-logstash-have-listen-snmptrap/44530/6 "2017-07-06T05:05:32Z")

</div>


