Splunk Search

Extract Fields from event

harsush
Path Finder

Hi Team,

Need your help to extract info from below event

HOST=amx0001d ALIVE_STATUS=UP host amx0001d up 12.05 days at time 1498725948 last file update 2 seconds ago /home disk used 31.22 percent last update 42 seconds ago memory+swap used 3.20 percent load 0.05 0.03 0.00 threads 543 procs running 0 procs blocked 0 total CPU used over last minute 0.08 percent (16 cores) total i/o wait over last minute 0.00 percent proc up 1041226 secs, reqs: pri 28096 -mi 0 rej 0, max secs in D state: 0

Output :
amx0001d STATUS = UP
amx0001d up since = 12.05 days
/home disk used percent = 31.22
memory+swap used percent = 3.20
load = 0.05
threads = 543
procs running = 0
procs blocked = 0
total CPU used percent = 0.08
total i/o wait percent = 0.00

Thanks

Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

This regex string will extract the fields you need from the text, assuming the order is constant. You can then put them together into the desired output.

HOST=(?<Host>\w+) ALIVE_STATUS=(?<STATUS>\w+).*? up (?<up_since>[\d\.]+\s\w+).*?(?<disk>\/\w+) disk used (?<disk_percent>[\d\.]+).*?memory\+swap used (?<mem_percent>[\d\.]+) percent load (?<load>[\d\.]+).*? threads (?<threads>\d+) procs running (?<procs>\d+) procs blocked (?<blocked>\d+) total CPU used over last minute (?<CPU_percent>[\d\.]+).*?i\/o wait over last minute (?<io_percent>[\d\.]+)
---
If this reply helps you, Karma would be appreciated.
0 Karma

adonio
Ultra Champion
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...