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!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...