Splunk Search

SPL to extract field and field value?

AK_Splunk
Explorer

SPL to extract field and field value when data seems like below

screenshot attached.
I need help in extracting field as memUsedPct which should hold the value as 82,3.
 

AK_Splunk_0-1667206415395.png

Labels (1)
0 Karma

AK_Splunk
Explorer

Thanks for your quick response.

| multikv forceheader=1

The multikv command isnt helping much.Currently I am getting balnk in the memUsedPct.

I need to extract only memUsedPct as 17,7.

0 Karma

yuanliu
SplunkTrust
SplunkTrust

You need to demonstrate your data, in text form. (Anonymize as needed, but maintain format.)  How does a _raw event look like?

0 Karma

yuanliu
SplunkTrust
SplunkTrust

Using screenshots to illustrate complex data is a terrible method.  Try using text.

This said, are you suggesting that you have input with CSV format?  One way to handle them is to use multikv.  Assuming that data is already in _raw:

| multikv forceheader=1

If it is that in _raw, but in a field called CSV_data, swap it with _raw,

| rename _raw as temp, CSV_data as _raw
| multikv forceheader=1
| rename temp as _raw ``` assume that you no longer care about CSV_data ```
Tags (1)
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...