Splunk Search

Splunk search bug on all data index but work well on few data

cros
Engager

Hi all, 

I'm creating couple of events with command : 

| streamstats window=2 list(PI_Event_Status) as status list(PI_Event_Time) as time list("PI Event Severity") as severity list("PI Event Urgency") as urgency by "Record Number", "PI Number" 

I notice that when i execute my command only on one "Record Number" (record number is an id) the command works as expected : 

cros_0-1612867521557.png

But when i execute the command on all index the command works partially : 

cros_1-1612867583443.png

Do you know why ? 

Regards,

Clément

 

Labels (1)
Tags (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Streamstats with a window of 2 is only looking at the current and previous event. By filtering on record name, you are guaranteeing that the two events will fit the by clause. Without the filter, the previous event might not be the same record type, hence only one time/status/etc. in your lists. In order to get the results you are expecting you could try sorting by record type and time prior to the streamstats, although I suspect that possibly defeats the purpose of using streamstats in the first place.

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Streamstats with a window of 2 is only looking at the current and previous event. By filtering on record name, you are guaranteeing that the two events will fit the by clause. Without the filter, the previous event might not be the same record type, hence only one time/status/etc. in your lists. In order to get the results you are expecting you could try sorting by record type and time prior to the streamstats, although I suspect that possibly defeats the purpose of using streamstats in the first place.

0 Karma

cros
Engager

@ITWhisperer thank you for your quick answer. 

I added the sort as you recommend it.

| sort "Record Number", "PI Number", time

 It seems to works well thank you

0 Karma
Get Updates on the Splunk Community!

New Year, New Changes for Splunk Certifications

As we embrace a new year, we’re making a small but important update to the Splunk Certification ...

Stay Connected: Your Guide to January Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...

[Puzzles] Solve, Learn, Repeat: Reprocessing XML into Fixed-Length Events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...