# Logstash JSON syslog\_message parsing

**URL:** <https://discuss.elastic.co/t/logstash-json-syslog-message-parsing/75526>\
**Category:** Logstash\
**Created:** [February 17, 2017, 3:46pm UTC](https://discuss.elastic.co/t/logstash-json-syslog-message-parsing/75526 "2017-02-17T15:46:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![blakefallow](https://avatars.discourse-cdn.com/v4/letter/b/e0b2c6/32.png) [@blakefallow](https://discuss.elastic.co/u/blakefallow)\
**Post date:** [February 17, 2017, 3:46pm UTC](https://discuss.elastic.co/t/logstash-json-syslog-message-parsing/75526/1 "2017-02-17T15:46:52Z")

</div>

**OS: Ubuntu 16.04 Logstash: 5.2.1 Elasticsearch: 5.1**

I've configured our Deis platform to send logs to our Logstack node with no issues. However, I'm still new to Ruby and Logstash is not yet my strong suit. I can't seem to get the syslog\_message to parse correctly.

**Log example:** `"February 15th 2017, 09:55:24.408 @timestamp:February 15th 2017, 09:55:24.408 @version:1 host:x.x.x.x message:2017-02-15T14:55:24UTC deis-logspout[1]: 2017/02/15 14:55:24 routing all to udp://x.x.x.x:xxxx type:json _id:AVpCRVUBf9TikzNy1yFB _type:json _index:logstash-2017.02.15 _score: -`

**Current configuration:**  
`input { tcp { port => 5000 type => syslog codec => plain } udp { port => 5000 type => syslog codec => plain } } filter { json { source => "syslog_message" } } output { elasticsearch { hosts => ["foo.somehost"] } stdout { codec => rubydebug } }`

**Elasticsearch output:**  
`"@timestamp" => 2017-02-15T14:55:24.408Z, "@version" => "1", "host" => "x.x.x.x", "message" => "2017-02-15T14:55:24UTC deis-logspout[1]: 2017/02/15 14:55:24 routing all to udp://x.x.x.x:xxxx\n", "type" => "json"`

**Desired outcome:**  
`"@timestamp" => 2017-02-15T14:55:24.408Z, "@version" => "1", "host" => "x.x.x.x", "type" => "json" "container" => "deis-logspout" "severity level" => "Info" "message" => "2017/02/15 14:55:24 routing all to udp://x.x.x.x:xxxx\n"`

What should I be doing to make this work right? Thank you for taking your time to look at this.

---

<div class="post-metadata">

**Author:** ![krishna\_chaitanya](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@krishna\_chaitanya](https://discuss.elastic.co/u/krishna_chaitanya)\
**Post date:** [February 17, 2017, 8:25pm UTC](https://discuss.elastic.co/t/logstash-json-syslog-message-parsing/75526/2 "2017-02-17T20:25:40Z")

</div>

**message** can be parsed by [grok](https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html#plugins-filters-grok) filter instead of JSON

---

<div class="post-metadata">

**Author:** ![Signus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/signus/32/37310_2.png) [@Signus](https://discuss.elastic.co/u/Signus)\
**Post date:** [February 23, 2017, 12:08am UTC](https://discuss.elastic.co/t/logstash-json-syslog-message-parsing/75526/3 "2017-02-23T00:08:40Z")

</div>

This was also asked on StackOverflow, which I've answered [here](http://stackoverflow.com/questions/42254930/logstash-json-parsing-filtering/42262494#42262494).

Ultimately OP was trying to parse the JSON results from 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:** [March 23, 2017, 12:08am UTC](https://discuss.elastic.co/t/logstash-json-syslog-message-parsing/75526/4 "2017-03-23T00:08:48Z")

</div>

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