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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...