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!

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud  In today’s fast-paced digital ...

Observability protocols to know about

Observability protocols define the specifications or formats for collecting, encoding, transporting, and ...

Take Your Breath Away with Splunk Risk-Based Alerting (RBA)

WATCH NOW!The Splunk Guide to Risk-Based Alerting is here to empower your SOC like never before. Join Haylee ...