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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...