Splunk Search

How to get the new errors that don't appear yesterday?

Jackiifilwhh
Path Finder

Hi everyone! We want to get the new errors that don't appear yesterday. For example, if an action named A. Its yesterday's error codes are A1, A2, A3. But its today's error codes are A1, A2, A4, A5. A4 and A5 are new errors. The fields we use in Splunk is below:

application: the name of an application
transId: the name of an action in our system
errorCode: the error code of an action once an exception occurred

The result we want to get for the example above is like below:

applicationtransIderrorCode
expAA4
expAA5

 

I've tried subsearch but it doesn't work well! Subsearch will be auto-finalized after 60s!

Labels (4)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

It doesn't have to - assuming _time is the time of the event, you could do this (amongst other approaches)

| eval day=strftime(_time,"%F")
| eval today=strftime(now(),"%F")

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Something like this (you will need to set up day and today - if you need help with that, just ask)

| stats values(day) as day by errorcode
| where mvcount(day)=1 AND day=today

 

0 Karma

Jackiifilwhh
Path Finder

you will need to set up day and today

Does it use relative_time()?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It doesn't have to - assuming _time is the time of the event, you could do this (amongst other approaches)

| eval day=strftime(_time,"%F")
| eval today=strftime(now(),"%F")

Jackiifilwhh
Path Finder

What you have benefited me deeply is your train of thought! It seems work well! Finally I want ask you a question: why don't you recommend me to use relative_time(). Is it inefficient? It's convenient to compare two time span.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

I didn't say don't use relative_time, I was just suggesting an alternative. Both are valid. I am unsure of their relative efficiencies but I suspect there may not be much between them.

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...