JSON and JSON_LINES delimiter

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: JSON and JSON_LINES delimiter

Post by scottwilkerson »

Andrew,

If you are going to change the format that syslog is sending messages, you will need to configure a different Input on a different port in Log Server because the default syslog input expects the format for the message to be RFC3164
vAJ wrote:Found this as well http://www.rsyslog.com/coupling-with-lo ... #more-2356 but NLS doesn't use redis.
Actually, you absolutely can send logs to a Redis server and add an input to pull logs from the Redis queue
Here's the input doc
https://www.elastic.co/guide/en/logstas ... redis.html
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: JSON and JSON_LINES delimiter

Post by hsmith »

Can you try to switch this to a different input that uses the json codec? You can see our Windows Event Log one for example.

Take a look at this: https://www.elastic.co/guide/en/logstas ... -json.html

Let me know if this doesn't make sense, or you need some further clarification.
Former Nagios Employee.
me.
vAJ
Posts: 456
Joined: Thu Nov 08, 2012 5:09 pm
Location: Austin, TX

Re: JSON and JSON_LINES delimiter

Post by vAJ »

I am. We send JSON logs to TCP/2057 and the input filter uses the JSON codec.
Andrew J. - Do you even grok?
vAJ
Posts: 456
Joined: Thu Nov 08, 2012 5:09 pm
Location: Austin, TX

Re: JSON and JSON_LINES delimiter

Post by vAJ »

My JSON input (i think it's default)

Code: Select all

tcp {
    type => 'import_json'
    tags => 'import_json'
    port => 2057
    codec => json
}
Andrew J. - Do you even grok?
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: JSON and JSON_LINES delimiter

Post by hsmith »

It's still coming through as one log, though?

Can I see a screenshot of it? This multiline stuff gets tricky.
Former Nagios Employee.
me.
vAJ
Posts: 456
Joined: Thu Nov 08, 2012 5:09 pm
Location: Austin, TX

Re: JSON and JSON_LINES delimiter

Post by vAJ »

I regret hijacking Fabian's thread...

I've been working with two different configs here. One with the JSON template, one without.

In the last rsyslog config I posted with just a straight forwarding of the log , I get the entire json message as a syslog event:
json_log_message.JPG
When we tried using the JSON template config in rsyslogd, it sent each line of JSON as a separate message.
json_messy.JPG
You do not have the required permissions to view the files attached to this post.
Andrew J. - Do you even grok?
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: JSON and JSON_LINES delimiter

Post by jolson »

Your log is being tagged with both a json parsefailure and a grok parsefailure. I am interested in seeing the filter that you have in place that's causing the grokparsefailure. Could you send us that information please?

Code: Select all

cat /usr/local/nagioslogserver/logstash/etc/conf.d/*
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
vAJ
Posts: 456
Joined: Thu Nov 08, 2012 5:09 pm
Location: Austin, TX

Re: JSON and JSON_LINES delimiter

Post by vAJ »

I'll try to get that. I'm not worried about the parsing yet, I just need to get the right rsyslogd config.
Andrew J. - Do you even grok?
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: JSON and JSON_LINES delimiter

Post by hsmith »

Unless I'm missing something, from what I understand, you want rsyslog to space it out and look nicer, instead of just sending it like one chunk of text like it is doing right now?
Former Nagios Employee.
me.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: JSON and JSON_LINES delimiter

Post by jolson »

Also, it's worth noting that the json decoding doesn't have to be done at the input level, it can be done at the filter level: https://www.elastic.co/guide/en/logstas ... -json.html

This way you could design a filter to strip the beginning syslog message and then parse the actualy JSON using the filter above.
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
Locked