Splunk IT Service Intelligence

How can I select only first line of a field to display

a1bg503461
Explorer

I am working on a KPI script and I need to deduplicate lines in the field 
Looks like this :
278.PNG

is there an | eval field= substr for first line of field  or some regex that can deduplicate my values. Thanks

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Are these multi-value fields?

| eval queue=mvindex(queue, 0)
| eval value=mvindex(value, 0)

If not, how did you get the values, perhaps they can be dedup'd before this point?

View solution in original post

0 Karma

a1bg503461
Explorer

mvindex works, THANKS! my bash script collects the log, I am still investigating why field gets doubled.

0 Karma

Farheen
Explorer

If you are getting these results from stats. You can try using latest function like below. However, it would be easier to address your question if you can share how you got this result.

|stats latest(queue) values(value) by some_other_field

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Are these multi-value fields?

| eval queue=mvindex(queue, 0)
| eval value=mvindex(value, 0)

If not, how did you get the values, perhaps they can be dedup'd before this point?

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...