Splunk Search

unable to extract all matching values in a single line; the interesting field only captures first matching value.

syjayaraj
Explorer

The string is a single line, i am unable to extract all matching value in this line.
The interesting fields that Splunk has, it extracts only name1 for e.g, name2, name3 and name4 are not being extracted.
may i request your help.

SNMPVariable value='name1' (oid='enterprises.14179.2.2.1.1.3.0.39.227.7.142.160', oid_index='', snmp_type='OCTETSTR'), 
SNMPVariable value='name2' (oid='enterprises.14179.2.2.1.1.3.0.163.142.226.49.48', oid_index='', snmp_type='OCTETSTR'), 
SNMPVariable value='name3' (oid='enterprises.14179.2.2.1.1.3.160.35.159.93.36.0', oid_index='', snmp_type='OCTETSTR'), 
SNMPVariable value='name4' (oid='enterprises.14179.2.2.1.1.3.160.35.159.93.55.112', oid_index='', snmp_type='OCTETSTR')
Tags (1)
0 Karma

somesoni2
Revered Legend

Splunk's automatic field extraction only captures single valued fields. If your data has multiple values for same field, you'd need to setup custom, multivalued field extraction for the same.
One method is using fields.conf: http://docs.splunk.com/Documentation/Splunk/7.1.2/Knowledge/ConfigureSplunktoparsemulti-valuefields

Other method is using transforms.conf: https://docs.splunk.com/Documentation/Splunk/7.1.2/Knowledge/Exampleconfigurationsusingfieldtransfor...

0 Karma

horsefez
Motivator

Hi @syjayaraj,
I don't believe that the name fields are static values and you are more going into a "Key-Value" extraction, but still I wanted to provide you with a solution for a static approach in splunk SPL.

| rex field=data max_match=0 ("value='name1'\s\((?<name1>[^\)]+)\)|value='name2'\s\((?<name2>[^\)]+)\)|value='name3'\s\((?<name3>[^\)]+)\)|value='name4'\s\((?<name4>[^\)]+)\)")

You might need to change the field=data to field=_raw in your case.

alt text

0 Karma

horsefez
Motivator

Can you please be a bit more specific on the actual values that get extracted @syjayaraj.

Also I need to know if you are trying to extract this data at index-time. (when you index the data) or at search time (when you search on the data, e.g. the | rex - command)

Get Updates on the Splunk Community!

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...

Unlock Instant Security Insights from Amazon S3 with Splunk Cloud — Try Federated ...

Availability: Must be on Splunk Cloud Platform version 10.1.2507.x to view the free trial banner. If you are ...