Getting Data In

Can you extract JSON syslog automatically?

tkwaller
Builder

Trying to get my syslog in json format to extract properly.

I've tried using INDEXED_EXTRACTIONS=JSON as well as KV_MODE=json(not at the same time) and neither have worked.

Here is a short sample log

Jun 13 15:41:27 host.domain.com {"account_id":"678", "legacy_domain_id":"12345", "visitor_ip":"xx.xxx.xxx.xx", "time":"1497368487.007","request":"GET /stuff/search/stuff/morestuff"}

Unfortunately it doesnt seem to be working as nothing gets extracted.
I'm sure its something I'm doing or something with the log format.
Any help would be apprciated.
Thanks!

Tags (3)
0 Karma
1 Solution

masonmorales
Influencer

JSON will not auto-extract with the timestamp/host prefix in your data. You can use a SEDCMD to strip it out in props.conf.

e.g.

[my_sourcetype]
SEDCMD-strip_prefix = s/^[^{]+//g
INDEXED_EXTRACTIONS=JSON
KV_MODE=none

You'll want to add TIME_PREFIX, TIME_FORMAT, etc. as well.

View solution in original post

masonmorales
Influencer

JSON will not auto-extract with the timestamp/host prefix in your data. You can use a SEDCMD to strip it out in props.conf.

e.g.

[my_sourcetype]
SEDCMD-strip_prefix = s/^[^{]+//g
INDEXED_EXTRACTIONS=JSON
KV_MODE=none

You'll want to add TIME_PREFIX, TIME_FORMAT, etc. as well.

tkwaller
Builder

Hello
Sorry for the delay, was super busy with work.
I knew it had to be something with the preceding data but wasn't sure. I added to the config and now it looks as such:
[syslogtest]
SEDCMD-strip_prefix = s/^[^{]+//g
INDEXED_EXTRACTIONS=JSON
KV_MODE=none
DATETIME_CONFIG =
TIME_FORMAT = %s.%6N
TIME_PREFIX = "time":"
NO_BINARY_CHECK = true
category = Custom
description = syslogtest
disabled = false
pulldown_type = true

I left the default stuff there.

Only now parsing doesnt take place:
06-19-2017 09:36:04.310 -0500 ERROR JsonLineBreaker - JSON StreamId:5377901818726410745 had parsing error:Unexpected character while looking for value: 'J' - data_source="C:\syslog.log", data_host="L-BDL-10007862", data_sourcetype="syslogtest"

Any thoughts?
Thanks!

0 Karma

darlas
Communicator

Hi.

I'm facing the same issue.

I've added the following to my props.conf but still not working.

SEDCMD-StripHeader = s/^[^{]+//g
KV_MODE=json

Does the associated TA need to be pushed to indexers as well as search heads?

Does there need to be a reference later in props.conf to the SEDCMD-StripHeader line?

Thanks!

0 Karma

andygerber
Path Finder

Thank you, just what I needed....

0 Karma

tkwaller
Builder

So it seems it wouldn't work with:
INDEXED_EXTRACTIONS=JSON

but it DID work with:
KV_MODE=json

Thanks for the help, I appreciate it!

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...