Getting Data In

How do you use extracted JSON fields in transactions and buckets?

nfieglein
Path Finder

I tried doing the following and got back nothing:
sourcetype=json | transaction 'LogEntry.Content.SvctagSegmentGrp.DpsNum'

but had no results. However, when I do the following, I get the expected results:
sourcetype=json | eval DispatchNumber='LogEntry.Content.SvctagSegmentGrp.DpsNum' | transaction DispatchNumber

Has anyone encountered this issue?

0 Karma
1 Solution

aweitzman
Motivator

Remove the single-quotes from your field name:

sourcetype=json | transaction LogEntry.Content.SvctagSegmentGrp.DpsNum

View solution in original post

aweitzman
Motivator

Remove the single-quotes from your field name:

sourcetype=json | transaction LogEntry.Content.SvctagSegmentGrp.DpsNum

nfieglein
Path Finder

OK, that worked for transaction, but when I do something like strptime, I need the single quotes. Is there some scorecard indicating when and when not?
eval TimeOpen = now() - strptime(LogEntry.Content.StatusSegmentGrp.StatusDate, "%a %b %d %H:%M:%S %Z %Y") - Does not Work
eval TimeOpen = now() - strptime('LogEntry.Content.StatusSegmentGrp.StatusDate', "%a %b %d %H:%M:%S %Z %Y") - Works

transaction LogEntry.Content.StatusSegmentGrp.StatusDate - Works
transaction 'LogEntry.Content.StatusSegmentGrp.StatusDate' - Does not Work

0 Karma

aweitzman
Motivator

Based on your two scenarios, it would appear that you need them when you're passing the field name to an eval function (like strptime), but not in the case where it's just an argument to a command (like transaction).

0 Karma

nfieglein
Path Finder

I would have thought so as well, however, when passing a field to a macro it only works with no single quotes. I think that there really needs to be a scorecard or some uniformity.

0 Karma

twhitehead
New Member

...many years later... I thought I would just add, I've seen similar symptoms, renaming your field before using it in eval and I believe a few other commands will keep it consistent for you.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...