Splunk Search

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

karthi2809
Communicator

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.
Register for .conf21 Now! Go Vegas or Go Virtual!

How will you .conf21? You decide! Go in-person in Las Vegas, 10/18-10/21, or go online with .conf21 Virtual, 10/19-10/20.