# Input stdin and snmptrap?

**URL:** https://discuss.elastic.co/t/input-stdin-and-snmptrap/80533
**Category:** Logstash
**Created:** [March 29, 2017, 6:28pm UTC](https://discuss.elastic.co/t/input-stdin-and-snmptrap/80533 "2017-03-29T18:28:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Dark\_Light](https://avatars.discourse-cdn.com/v4/letter/d/7ba0ec/32.png) [@Dark\_Light](https://discuss.elastic.co/u/Dark_Light)
#### Post date: [March 29, 2017, 6:28pm UTC](https://discuss.elastic.co/t/input-stdin-and-snmptrap/80533/1 "2017-03-29T18:28:51Z")

</div>

I am using stdin for testing of the logstash .conf files and need to input some snmptrap messages received from splunk in json format.

The first roadblock seems to be I cannot use snmptrap input as a sub input from stdin. Is there a method to make this work?

I need the functionality of the decoding of the snmptrap message MIB

* * *

input {  
stdin {  
snmptrap  
yamlmibdir =\> "/usr/share logstash/vendor/bundle/jruby/1.9/gems/snmp-1.2.0/data/ruby/snmp/mibs/DISMAN-EVENT-MIB"  
}  
}

* * *

This is my input data I drop into stdin:

{"preview":false,"offset":13,"result":{"_raw":"2017-03-02 14:15:17 UDP: [10.248.254.12]:59163-\>[172.16.100.30]:162 [UDP: [10.248.254.12]:59163-\>[172.16.100.30]:162]:\nDISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (4227099402) 489 days, 5:56:34.02\tSNMPv2-MIB::snmpTrapOID.0 = OID: BFD-STD-MIB::bfdSessUp\tBFD-STD-MIB::bfdSessDiag.54054154 = Gauge32: 1\tBFD-STD-MIB::bfdSessDiag.54054154 = Gauge32: 1\tBFD-STD-MIB::bfdSessAddrType.54054154 = INTEGER: ipv4(1)\tBFD-STD-MIB::bfdSessAddr.54054154 = Hex-STRING: 7F 00 00 01 \tJUNIPER-BFD-MIB::jnxBfdSessifName.0 = STRING: ge-0/0/1.0\tSNMPv2-MIB::snmpTrapEnterprise.0 = OID: JUNIPER-CHASSIS-DEFINES-MIB::jnxProductName.97","time":"2017-03-02T14:15:17.000-0800","date\_hour":"14","date\_mday":"2","date\_minute":"15","date\_month":"march","date\_second":"17","date\_wday":"thursday","date\_year":"2017","date\_zone":"local","host":"10.248.254.12","index":"network","linecount":"2","punct":"--::_:_[...]:-\>[...]:_[:_[...]:-\>[...]:]:--::_=\_:","source":"/data/splunk/snmptraps/messages","sourcetype":"snmptrapd","splunk\_server":"[is-spidxrbn-p01.sempra.com](http://is-spidxrbn-p01.sempra.com)","timeendpos":"19","timestartpos":"0"}}

Thank you

---

<div class="post-metadata">

### Author: ![jsvd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsvd/32/6203_2.png) [@jsvd](https://discuss.elastic.co/u/jsvd)
#### Post date: [March 31, 2017, 5:13pm UTC](https://discuss.elastic.co/t/input-stdin-and-snmptrap/80533/2 "2017-03-31T17:13:14Z")

</div>

if you just want to test it, you can start logstash with just the snmptrap input, and then in a separate terminal run `cat data.example.log| nc localhost 1062` to send data from that file to logstash

---

<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: [April 28, 2017, 5:14pm UTC](https://discuss.elastic.co/t/input-stdin-and-snmptrap/80533/3 "2017-04-28T17:14:07Z")

</div>

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