Splunk Search

How to parse a field value that is delimited by "/"

glenngermiathen
Path Finder

I have a field for a CVSS vector, and I want to parse it so I can compare each section to a lookup and put it in layman's terms in its own field. For example
CVSS vector
AV:N/AC:L/Au:N/C:N/I:N/A:P

My lookup has two fields
Vector Definition
AV:N Remotely Exploitable
AC:L Easily Exploitable

Then I want a field named
Access_Vector
Remotely Exploitable

and so on. I think Im good on the lookup and creating the table, but how do I parse the cvss vector so I can compare them to the lookup?

Tags (3)
0 Karma

harsmarvania57
SplunkTrust
SplunkTrust

Hi,

Can you please try this query and change field name based on your actual field? First 2 lines are used for generating sample data.

    | makeresults 
    | eval field1="AV:N/AC:L/Au:N/C:N/I:N/A:P"
    | makemv delim="/" field1
    | mvexpand field1
    | lookup <LOOKUP NAME> Vector AS field1 OUTPUT Definition

glenngermiathen
Path Finder

@harsmarvania57's answer does work. Just need a little help with the table per the comments above.

| makeresults 
| eval field1="AV:N/AC:L/Au:N/C:N/I:N/A:P"
| makemv delim="/" field1
| mvexpand field1
| lookup  Vector AS field1 OUTPUT Definition
0 Karma

glenngermiathen
Path Finder

This works, but a little differently than expected. So now I do have a challenge with the table. How do I get each of the definitions as its own field?

0 Karma

somesoni2
SplunkTrust
SplunkTrust

What's the final output you expect (based on your sample data)?

0 Karma

glenngermiathen
Path Finder

It would look something like this with fields for CVE, Access_Vector, Complexity
CVE Access_Vector Complexity
CVE-2017-1234 Remotely Exploitable Easily Exploitable
CVE-2017-1235 Physical Access Easily Exploitable

0 Karma

somesoni2
SplunkTrust
SplunkTrust

What are you getting now with @harsmarvania57's answer?

0 Karma

glenngermiathen
Path Finder

Now they are each a row in the table with the CVE repeating:
CVE Definition
CVE-2017-1234 Remotely Exploitable
CVE-2017-1234 Easily Exploitable
CVE-2017-1235 Physical Access
CVE-2017-1235 Easily Exploitable

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Will it always be two rows for each CVE or can be many? If it can be many how do you decide on the column name for it (e.g. in your example results, you've Access_Vector as Remotely Exploitable and Physical Access, and Complexity as Easily Exploitable)

0 Karma

glenngermiathen
Path Finder

The number of columns will always be 6, I used 2 in the example for simplicity. Each column can have multiple different values. For the column name I was think of doing an eval or just rename, or I could add it to the lookup if that is more useful.

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Adding to lookup will be a better option. So, say your lookup now have 3 columns Vector, Name, Definition, your query will be like this

| makeresults 
| eval field1="AV:N/AC:L/Au:N/C:N/I:N/A:P"
| makemv delim="/" field1
| mvexpand field1
| lookup YourLookupHere Vector AS field1 OUTPUT Name as Access_Vector Definition as , Complexity | xyseries CVE Access_Vector Complexity 
0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...