Splunk Search

Regex on a Nessus CSV in props.conf

jizzmaster
Path Finder

I have some Nessus vulnerability scanner exports I am trying to properly parse in Splunk. The output is CSV (I know there's an app for Nessus and I have reasons for not using it). I'm grabbing KV pairs via props.conf. However, the OS signature is not extracting well.

What I would like to do is capture the text after "Remote operating system : " until the end of the line.

Here's the relevant props.conf line: EXTRACT-OS = Remote\soperating\ssystem\s:\s(?.*)Confidence

The reason for the "Confidence" word in there is because the regex in props.conf will not work with typical end-of-line notations, like $, or \r\n, or \n. Basically, I'm seeing that props.conf is including line breaks automatically in searches, but not allowing me to use them. This works for most OS signatures except those that list multiple OSes.

Here's a relevant section from the CSV:


Remote operating system : CISCO IOS 15
CISCO IOS 12
Cisco IOS XE
CISCO PIX
Confidence Level : 69
Method : SSH

When I open the original CSV in Notepad++, it shows each line ends with a "LF" (line feed, I believe). And at the very end of all of it, there is an "LF" and a "CR". It seems to treat "$" as the "CR." How do I get my props.conf line to stop reading after the very first "LF", the "CISCO IOS 15" in this specific example?

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

This works for me using your example data.

Remote\soperating\ssystem\s:\s([\w ]*)
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

This works for me using your example data.

Remote\soperating\ssystem\s:\s([\w ]*)
---
If this reply helps you, Karma would be appreciated.
0 Karma

jizzmaster
Path Finder

This worked perfectly. I'm curious as to why, though, especially putting in a space after the \w. I didn't think the pcre would even recognize that, much less use it. And why would the line breaks be included without the \w?

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Apparently, there is an implicit (?s) flag (do you have SHOULD_LINEMERGE set?) which means the dot specifier will match line ends. Using [\w ] will match word characters and spaces, but not newlines. You can put any character within brackets (some need to be escaped) and regex will match on them.

Check out regex101 for a great regex test tool.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...