Splunk Search

How to extract logs by rex ?

karthi2809
Builder

How to extract logs by rex ?
"TranStartTime":"2017-05-08T02:40:58.856-04:00", "TranEndTime":"2017-05-08T02:40:58.902-04:00"

need to TranStartTime and TranEndTime

Tags (1)
0 Karma

cpetterborg
SplunkTrust
SplunkTrust

Try this:

_your_search_ | rex "\"TranStartTime\":\"(?P<tranStartTime>[^\"]*)\",\s\"TranEndTime\":\"(?P<tranEndTime>[^\"]*)\""

DalJeanis
Legend

I'd probably put them in two separate rexes, just in case they ever arrived in a different order or separated by something else. Upvoted anyway, it works per regex101.com.

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...