Splunk Search

regular expression for multi lineevent

darksky21
Path Finder

Hi i have an event

Filename : 1.htm
Content Type : text/html; charset=utf-8

how can i extract the (1.htm only)
i tried ending the string with space but the regex still give me (1.htm Content Type : text/html; charset=utf-8)

sorry new to regex

Tags (1)
0 Karma

kristian_kolb
Ultra Champion

Hi

... | rex  "(?m)Filename\s+:\s+(?<file_name)[^\r\n]+)"

Should work. If you're happy, then you can put it in props.conf to make it more permanent;

[your_sourcetype]
EXTRACT-blah =  (?m)Filename\s+:\s+(?<file_name)[^\r\n]+)

Ayn
Legend

...well what's the regex you're using?

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