Splunk Search

Is it possible to break a value down to partial values as a match or field?

Minasdad
Path Finder

So I have a field (plugin_output)that has a paragraph of hardware info as one value. The only part of the value I'm concerned with is the "Computer SerialNumber". Is it possible to break this value down into multiple values? I've tried field extraction with no luck, it may be possible to do a string search, but I would also need variables to account for the actual serial number value I want.

<plugin_output> Computer Manufacturer : VMware, Inc. Computer Model : VMware7,1 Computer SerialNumber : VMware-65 6d 69 60 3b 89 2a a0-3b 4e bb 3f 2a 95 2f 49 Computer Type : Other Computer Physical CPU's : 2 Computer Logical CPU's : 4 CPU0 Architecture : x64 Physical Cores: 2 Logical Cores : 2 CPU1 Architecture : x64 Physical Cores: 2 Logical Cores : 2 Computer Memory : 8190 MB RAM slot #0 Form Factor: DIMM Type : DRAM Capacity : 8192 MB </plugin_output>

Labels (4)
0 Karma
1 Solution

Minasdad
Path Finder

Thanks for you help, I figured it out, building on your rex query. 

sourcetype=tenable:sc:vuln SerialNumber
| rex max_match=0 field=_raw "Computer SerialNumber : (?<ComputerSerialNumber>.+) Computer Type" | table ComputerSerialNumber

View solution in original post

0 Karma

Minasdad
Path Finder

Thanks for you help, I figured it out, building on your rex query. 

sourcetype=tenable:sc:vuln SerialNumber
| rex max_match=0 field=_raw "Computer SerialNumber : (?<ComputerSerialNumber>.+) Computer Type" | table ComputerSerialNumber

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

(I unlinked your example as it referred to your server)

Can you post the raw event (desensitised of course) in a code block </> so we can see what you are actually dealing with?

If not, try this

| rex "Computer SerialNumber : (?<ComputerSerialNumber>.+) Computer Type"
0 Karma

Minasdad
Path Finder

Your rex query actually came fairly close to isolating the string, it return every string that started with "Computer" which is alot closer and a much smaller return then the whole value.

0 Karma

Minasdad
Path Finder

I randomized parts of that value to define a non-existent server.  I posted that example to show that the field had a single value with multiple strings. I'm trying to parse the strings to single out the Serial Number.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Fair enough (on the randomising) - the problem you appear to have is that there is no clear delimiter between key/value pairs in the string (obviously keys and values appear to be separated by colons). You could expand the rex or have multiple rex commands to anchor the pattern before and after the values you want (as I have shown for the serial number), but unless there is an invisible delimiter, it would be difficult to make it generic.

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...