Splunk Enterprise Security

How to read a field from a result using a search?

rendie
Path Finder

Hi everyone,

Can I read the value of a field from each previous result using a search? Something similar to:

 

| streamstats current=f last(status) as lastStatus by _time
| eval status = if(isnull(lastStatus), 0, lastStatus+1)
| table status, lastStatus

 

I want to get the result:

statuslastStatus
10
21
32

 

Is it possible?

Thanks

Labels (2)
0 Karma

scelikok
SplunkTrust
SplunkTrust

If you run this command after table command it will pick the status field from table output. There is no difference.

Please describe your goal better, maybe sample data, sample output, sample SPL ...

If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma

rendie
Path Finder

The main point is in next:

For example, we have an index where are the next sample of the data:

timenumber
18:010
18:021
18:031
18:040
18:051

 

And I want to create a search that will do the next steps: 1. If 'number' is '1' then to new field add +1

| eval count = 0
| streamstats current=f last(count) as lastCount by _time
| eval count = if(isnull(lastCount), 0, lastCount+1)
| table time, number, count

// but this search doesnt work

 

And the result in the table should be

timenumbercount
18:0100
18:0211
18:0312
18:0402
18:0513
0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @rendie,

You can use autoregress command;

| autoregress status as lastStatus p=1
| table status lastStatus
If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma

rendie
Path Finder

This command works similar to | streamstats. They get the last value from an event in an index, but not from the result in a table.

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...