Splunk Search

Consecutive characters dash in a file for extraction

royimad
Builder

I have a file that contains consecutive -

example: somefields - anything - anything - ... - anything ABC DEF 23232 - anything

How do i extract the content of the delimited field between the 7 - "dash" and the 8 - "dash"?
PS: I don't want to use transform.conf with DELIM="-", i need to use regular expression for this field only the one between the dash number 7 and the dash number 8.

Tags (4)
0 Karma

Ayn
Legend
(?:[^-]*\-){7}(?<yourfield>[^-]*)

should do it. Verify at regexpal.com or similar (remove ?<yourfield> when you do this).

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 ...