Splunk Search

How to set message for status for job not run on saturday sunday ?

karthi2809
Builder

How to set status message for job not ran on saturday and sunday .here the query which i used in case statement.In my query its only working for saturday.but not getting for sunday.

Thanks in advance

index=xx* app_name="xxx" OR cf_app_name="yyy*" OR app_name="ccc"
|span_time span=1d |eval dayweek=strftime(_time,"%H")|convert timeformat="%m-%d-%y" ctime(_time) as c_time|eval Job = case(like(msg, "%first%"), "first Job", like(msg, "%second%"), "second Job", like(msg, "%third%"), "third job",like(msg, "%fourth%"), "fourth job")| stats count(eval(like(msg, "%All feed is completed%") OR like(msg, "%Success:%") OR like(msg, "%Success: %") OR like(msg, "%Finished success%"))) as Successcount count(eval(like(msg, "%Fatal Error: %") OR like(msg, "%Fatal Error:%") OR like(msg, "%Job raised exception%") AND like(msg, "% job error%"))) as failurecount by Job c_time dayweek|eval status=case((Job="fourth job") AND (dayweek=="Saturday" OR dayweek=="Sunday"),"NA",Successcount>0,"Success",failurecount>0,"Failure")| xyseries Job c_time status

 

Labels (2)
Tags (1)
0 Karma

rnowitzki
Builder

Hi @karthi2809 ,

I am not sure why Saturday works, because your field "dayweek" actually holds the Hour as a number (%H)  and not the name of the weekday.  The full weekday name is "%A".  Or you work with %w (0 = Sunday, ..., 6 = Saturday).

BR
Ralph

--
Karma and/or Solution tagging appreciated.


--
Karma and/or Solution tagging appreciated.
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...