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!

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!

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

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...