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!

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 ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...