Splunk Search

How to retrieve the final value from the last instance of a field?

KyleMcDougall
Path Finder

Hello,

I'm trying to pull the final value for a product name. In a single event, we make multiple calls to an API for the product name and the product may change with each API call. I'm trying to build out a table for the final product name (the field doesn't change), but can't figure out what command to use.

Here's what I have so far. 

 

 

index=conversation crm_accounts_phone__product_name=*
| rename crm_accounts_phone__product_name as product
| stats latest(product)
| table product

 

 

 Appreciate any help!

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

If latest() is not working for you, try

| stats last(product)

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

If latest() is not working for you, try

| stats last(product)
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

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