Splunk Search

extract custom filed and display value in the table output

narenpg
Explorer

Query
index=java networkenv=prod stackenv=prod source="/opt/jboss/standalone/custom_engine.log"
|convert ctime(_time) as time timeformat="%m/%d/%Y %H:%M:%S"
|rex field=_raw ""orderEnteredBy":\"(?[^\"]+\")"
|table time orderEnteredBy

It matches the word orderEnteredBy but when i tried to get the name into the table it shows empty..

Here is the log
availableBalance":{},"projectedBalance":{}}},"productSummary":{"symbol":"RPACX","displayValue":"RPACX","cusip":"32254T759","assetType":"MUTUAL_FUND","description":"UFACRESCENT FUND N/L","settlementDuration":4,"omnibusProduct":true},"orderEnteredBy":"JANEDOE","orderUpdatedBy":"SYS_USER","dirtyFSTT":false,"messagesSummary":{"messagesCount":2,"errorsCount":0,"warningsCount":0,"infosCount":0},"assetType":"MUTUAL_FUND","fundServTransactionTypeDetails":{"cdscValueOverridable":false,"netAssetValue":"NAV_OTHER","rightsOfAccumulation":{"additionalHoldings":0,"manualOverride":false,"additionalHoldingsValid":true}

Labels (3)
Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @narenpg,
to display code use the Code sample button (the one with 101010)
Anyway the correct search should be:

index=java networkenv=prod stackenv=prod source="/opt/jboss/standalone/custom_engine.log"
| convert ctime(_time) as time timeformat="%m/%d/%Y %H:%M:%S"
| rex "\"orderEnteredBy\":\"(?<orderEnteredBy>[^\"]*)\""
| table time orderEnteredBy

You can test the regex at https://regex101.com/r/5D8hAf/1

Ciao.
Giuseppe

View solution in original post

0 Karma

narenpg
Explorer

Oops Sorry it is working... There was a typo.. Thanks a lot

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @narenpg,
to display code use the Code sample button (the one with 101010)
Anyway the correct search should be:

index=java networkenv=prod stackenv=prod source="/opt/jboss/standalone/custom_engine.log"
| convert ctime(_time) as time timeformat="%m/%d/%Y %H:%M:%S"
| rex "\"orderEnteredBy\":\"(?<orderEnteredBy>[^\"]*)\""
| table time orderEnteredBy

You can test the regex at https://regex101.com/r/5D8hAf/1

Ciao.
Giuseppe

0 Karma

narenpg
Explorer

I did use the regex101 for this.. After using your regex, i am still not seeing the output for the table orderEnteredBy. Do i have to use makeresults

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @narenpg,
no makeresuts generates the specified number of search results, you have to use your search,
did you're using a Fast Mode or a Verbose Mode?
If Fast, try Verbose.

Ciao.
Giuseppe

0 Karma

narenpg
Explorer

Somehow the name value is missed from my post
|rex field=_raw ""orderEnteredBy":\"(?[^\"]+\")"

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...