Splunk Search

How to extract multikv field at search-time with dynamic field names from Cisco ISE events?

solarboyz1
Builder

I have events from a Cisco ISE device that have multiple (up to 12) "posture reports" per message:

… PostureReport=21 Disk Encryption -- Decrypted\;Passed\;( Disk Encryption Status-Decrypted:Audit:Passed:Passed_Conditions[]:Failed_Conditions[Disk_Encryption_Decrypted_x64:Disk_Encryption_Decrypted_x86:Disk_Encryption_Decrypted]:Skipped_Conditions[]), PostureReport=71 BigFix Service Policy\;Passed\;(BigFix Service Status:Audit:Passed:Passed_Conditions[BigFix_Service_Check]:Failed_Conditions[]:Skipped_Conditions[]), PostureReport=40 Lumension Policy\;Passed\;(Lumension Status:Mandatory:Passed:Passed_Conditions[Lumension_Service_Check]:Failed_Conditions[]:Skipped_Conditions[Lumension_OIG2_Bypass_Check:Lumension_OIG_Bypass_Check]), PostureReport=50 McAfee ePO Install Policy\;Passed\;(McAfee ePO Install Status:Audit:Passed:Passed_Conditions[McAfee_EPO_Registration_Check]:Failed_Conditions[]:Skipped_Conditions[McAfee_EPO_Registration_Check_x86:McAfee_EPOUC_Registration_Check_x86:McAfee_EPOUC_Registration_Check]), PostureReport=81 SCCM Service Policy\;Passed\;(SCCM Service Status:Audit:Passed:Passed_Conditions[SCCM_Service_Check]:Failed_Conditions[]:Skipped_Conditions[]),  ...

The format of the data I am trying to extract is as follows:

PostureReport=21 Disk Encryption -- Decrypted\;Passed\;( Disk Encryption Status-Decrypted:Audit:Passed:Passed_Conditions[]:Failed_Conditions[Disk_Encryption_Decrypted_x64:Disk_Encryption_Decrypted_x86:Disk_Encryption_Decrypted]:Skipped_Conditions[]),

I need to extract the data in the parenthesis for each PostureReport line in the message. The Name of the field need to be dynamically created using the check name which is pulled from the first spot in parenthesis ending at the colon(:). For the message above I would like:

Multikv Field name=Disk_Encryption_Status-Decrypted

Multikv values:
Disk_Encryption_Status-Decrypted[0] = Audit
Disk_Encryption_Status-Decrypted[1]=Passed
Disk_Encryption_Status-Decrypted[2]=[]
Disk_Encryption_Status-Decrypted[3]=Disk_Encryption_Decrypted_x64:Disk_Encryption_Decrypted_x86:Disk_Encryption_Decrypted]
Disk_Encryption_Status-Decrypted[4]=[]

Or dynamically create field names using the checkname:

Disk_Encryption_Status-Decrypted_type = Audit
Disk_Encryption_Status-Decrypted_status=Passed
Disk_Encryption_Status-Decrypted_passed=[]
Disk_Encryption_Status-Decrypted_failed=Disk_Encryption_Decrypted_x64:Disk_Encryption_Decrypted_x86:Disk_Encryption_Decrypted]
Disk_Encryption_Status-Decrypted_skipped=[]

0 Karma

solarboyz1
Builder

The field name for the tests need to by dynamic. A simple rename doesn't work, unless I can use the value of the field name. Splunk has confirmed that as of version 6.2 this cannot be done at search time.

0 Karma

tachifelix
Path Finder

try to use rex command in your search like this:

 ...|rex "(?i).*?--\w+;\w+;Disk Encryption Status-Decrypted.(?P<FIELDNAME1>\w+[ ^]):(?P<FIELDNAME2>\w+[ ^]):(?P<FIELDNAME3>\w+[ ^])"|rex "Failed_Conditions.(?P<FIELDNAME4>Disk_Encryption_Decrypted_x\d\d:Disk_Encryption_Decrypted_x\d\d:Disk_Encryption_Decrypted_*x*\d*)" |rename FIELDNAME3 as Disk_Encryption_Status-Decrypted|....
0 Karma