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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...