Getting Data In

need help in formatting the data

saifuddin9122
Path Finder

Hello All,

i'm trying to format the "json" formatted data with a custom sourcetype. below are my sample events
{"formatVersion":"1.0", "vendor":"BeyondTrust","product":"BeyondInsight","version":"6.3.1","agentid":"PBPS","severity":"0","eventid":"PBPS","eventname":"Requestor","eventdesc":"Request Response Expire","eventdate":"Nov 07 2017 21:31:11","sourcehost":"test-vm-1","sourceip":"127.0.0.1","eventsubject":"0127.0.00.001","eventtype":"0","user":"ssltest", "nvps" : {"clienthost":"test-vm-1", "eventseverity":"0", "logsystemid":"121", "logtime":"11/07/2017 21:31:11", "username":"ssltest", "userid":"2", "roleused":"Requestor", "objecttypeid":"7", "objecttype":"Request Response", "objectid":"14", "operation":"Expire", "failed":"False", "target":"localhost/btuser", "details":"ReleaseRequest #9"}}{"formatVersion":"1.0", "vendor":"BeyondTrust","product":"BeyondInsight","version":"6.3.1","agentid":"PBPS","severity":"0","eventid":"PBPS","eventname":"System","eventdesc":"Release Request Expire","eventdate":"Nov 07 2017 21:31:11","sourcehost":"test-vm-1","sourceip":"127.0.0.1","eventsubject":"0127.0.00.001","eventtype":"0","user":"Internal process","workgroupid":"1","workgroupdesc":"BeyondTrust Workgroup", "nvps" : {"clienthost":"test-vm-1", "eventseverity":"0", "logsystemid":"122", "logtime":"11/07/2017 21:31:11", "username":"Internal process", "userid":"0", "roleused":"System", "objecttypeid":"6", "objecttype":"Release Request", "objectid":"9", "operation":"Expire", "failed":"False", "target":"ManagedSystem=localhost ManagedAccount=btuser", "details":"ReleaseRequest #9, Ticket #, TicketSystem="}}

and props.conf is
"TIME_PREFIX=\"eventdate\":\"
TIME_FORMAT= %b %d %Y %H:%M:%S
LINE_BREAKER=([\r\n]+)\s*{"formatVersion
SHOULD_LINEMERGE=false
ANNOTATE_PUNCT=false
TRUNCATE = 0
KV_MODE=json
AUTO_KV_JSON=true"

i facing issue at line breaker can any one help me?

0 Karma

maciep
Champion

Where are your lines breaking now? Just every line? Regardless, a few thoughts...

First, is the quote (") in front of your TIME_PREFIX a typo? if not, you probably want to get rid of that.

Second, have you tried escaping the curly brace in your line breaker? I don't think it should need escaped, but might be worth trying.

Third, do you have these settings on your indexer? If not, where are they and where are you ingesting the data?

0 Karma

nileena
Path Finder

You could use props and transforms to extract key values pairs for json events.

Include this line for the sourcetype in question in the props.conf

    [sourcetype]
    TIME_PREFIX=\"eventdate\":\"
    TIME_FORMAT= %b %d %Y %H:%M:%S
    LINE_BREAKER=([\r\n]+)\s*{"formatVersion
    SHOULD_LINEMERGE=false
    ANNOTATE_PUNCT=false
    TRUNCATE = 0
    REPORT-json_extraction = json_trans

and in the respective transforms.conf:

    [json_trans]
    REGEX = \"([^\":]+)\":\"([^\"\{]+)\"\s*,*\}*
    FORMAT = $1::$2

Sometimes, directly using regex works better than auto_kv or kv_mode or spath.

0 Karma

saifuddin9122
Path Finder

i tried it but still same issue.

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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...