Splunk Search

Getting value from more than one event ago

TBo123
Path Finder

Hello again,

here is my search result:

_time ID1 ID2
1.1.09 30122 1
1.1.09 30122 1
1.1.09 30127 2
1.1.09 30128 2
1.1.09 30129 2
1.1.09 30129 2
1.1.09 30130 3
1.1.09 30131 3

I'd like to have something like this:

_time ID1 ID2
1.1.09 30122 1
1.1.09 30122 1
1.1.09 30127 2
1.1.09 30127 2
1.1.09 30127 2
1.1.09 30127 2
1.1.09 30130 3
1.1.09 30130 3

ID2 shows when ID1 should change the value. All events that have the same ID2 should get the first value from ID1 for that group.

I hope someone can help me.

Thanks.

Tags (1)
0 Karma
1 Solution

strive
Influencer

I created a CSV using your first resultset and tested it.

Try this

Your search terms... | eventstats first(ID1) as temp_id1 by ID2 | fields - ID1 | rename temp_id1 as ID1

View solution in original post

strive
Influencer

I created a CSV using your first resultset and tested it.

Try this

Your search terms... | eventstats first(ID1) as temp_id1 by ID2 | fields - ID1 | rename temp_id1 as ID1

TBo123
Path Finder

thank you, that is exactly what I am looking for, great..

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...