Splunk ITSI

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!

Financial Services Industry Use Cases, ITSI Best Practices, and More New Articles ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Splunk Federated Analytics for Amazon Security Lake

Thursday, November 21, 2024  |  11AM PT / 2PM ET Register Now Join our session to see the technical ...

Splunk With AppDynamics - Meet the New IT (And Engineering) Couple

Wednesday, November 20, 2024  |  10AM PT / 1PM ET Register Now Join us in this session to learn all about ...