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’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...