Splunk Search

How to extract the integer values from my sample log?

lksridhar
Explorer

Hi Everyone,

Could you please anyone help me to extract the Integer values from the below log? Please share the query to extract the seconds value from the logs.

Nov 30, 2016 09:31:04 AM CST INFO (TransactionSearchDelegateImpl.java:54) - String=[Transaction Search Results. Transactions Count Is], String=[], Integer=[351]

Thanks,
Sridhar

0 Karma
1 Solution

niketn
Legend

You can use your dummy data on regex101 to evaluate your regular expressions.

rex field=_raw ", Integer=\[(?<Integer>\d+)\]"

PS: Once you test across your data, you should move the same as Field Extraction Knowledge Object as that is easier to maintain and reuse. You can do the same via Extract New Fields option during search (Interactive) or from Settings --> Knowledge --> Fields --> Field Extractions or directly editing props.conf.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

0 Karma

niketn
Legend

You can use your dummy data on regex101 to evaluate your regular expressions.

rex field=_raw ", Integer=\[(?<Integer>\d+)\]"

PS: Once you test across your data, you should move the same as Field Extraction Knowledge Object as that is easier to maintain and reuse. You can do the same via Extract New Fields option during search (Interactive) or from Settings --> Knowledge --> Fields --> Field Extractions or directly editing props.conf.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

ddrillic
Ultra Champion

Try please -

| rex field=_raw Integer=\[(?<int_num>\d*)\]

It should create the int_num field.

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!

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...

Global Splunk User Group Events: May + June 2026

Your Splunk Community Awaits: Discover Upcoming User Group Events Worldwide    Staying ahead in the fast-paced ...