Splunk Search

Inconsistent result between events and statistics- is this a limitation of custom scripts or configuration issue?

johanhakim
Explorer

Hi,

I have a custom Python script developed in Splunk where it will translate Chinese characters to English. The custom search was built following the guide below:

https://dev.splunk.com/enterprise/docs/devtools/customsearchcommands/

However, when we perform a search, the no. of Events does not tally with Statistics. For example, there are total of 8 events but only 1 in statistics. Sometimes it tallies, but most of the time it doesn't.

Would like to know if this is a limitation within Splunk when using custom scripts or is there some configuration that is not taking place? Appreciate the help.

sample.PNGsample2.PNGsample3.PNG

Labels (3)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It is not possible to tell what is going on without more information.

Having said that, the number of statistic events is the number of "rows" in the statistics table at the end of the search not the number of original events found at the beginning of the search query.

Something in your SPL is either filtering out events or aggregating events in order to reduce the number of rows in the statistics table.

One possibility, given your scenario, is that the python script is failing to return "translated" events in some circumstances. Does your custom command have any debugging capabilities or tracing written to its log to help you understand what is going on?

0 Karma

johanhakim
Explorer

Yes, I suspect that the SPL might be causing the inconsistency.

Below is a sample of my SPL:

index=idnxame host=*host1* EventCode=*
| rename Message as cntrfncn_Message
| table _time,cntrfncn_Message,EventCode
| cntranslate

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

There doesn't appear to be anything in the SPL which would remove events from the list returned by the initial search so it is likely to be the custom command which is not returning events in some circumstances.

0 Karma
Get Updates on the Splunk Community!

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

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...