Splunk Search

Best way to combine a variable number of fields into a single field

responsys_cm
Builder

The Linux audit daemon can track the execution of individual commands. Each part of the command is stored in a separate field such as:

a0=/bin/sh a1=/sbin/service a2=auditd a3=status

What is the easiest way to combine an arbitrary number of different fields that share a common naming scheme into a single field, such that the example above would look like:

"/sbin/service auditd status"

Would you use rex set to match multiple times for something like: "a\d\=(?P<command>\S+)" and then make it a multivalued field with a space for a delimiter?

Thx.

C

Tags (1)
0 Karma

dart
Splunk Employee
Splunk Employee

A cheating way to do this would be to run it through sed, like so
| rex field=_raw mode=sed "s/a\d=//g"

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...