<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Highlight with color if SLA missed in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363364#M160549</link>
    <description>&lt;P&gt;Hi Team,&lt;/P&gt;

&lt;P&gt;Below my search from which i am getting the completion time of job. I need ur help for couple.&lt;/P&gt;

&lt;P&gt;1 - If Below search won't get completion time/Completion_Time_Hour  &amp;gt; SLA time  is there a way to change the cell color.&lt;BR /&gt;
2 - How to calculate time Difference ( SLA  - Completion_Time_Hour )&lt;/P&gt;

&lt;P&gt;eval diff = SLA-Completion_Time_Hour  is now working &lt;/P&gt;

&lt;P&gt;Supported fields : &lt;BR /&gt;
CYCLE,CheckPoint,Job,SLA&lt;BR /&gt;
BAT_A,BAT1,PROD.BAT1.XYZ,10:30&lt;BR /&gt;
BAT_A,BAT2,PROD.BAT2.XYZ,09:30&lt;BR /&gt;
BAT_B,BAT1,PROD.BAT1.XYZ,07:30&lt;BR /&gt;
...&lt;BR /&gt;
...&lt;BR /&gt;
....&lt;/P&gt;

&lt;P&gt;| inputlookup PROD_BOX_CO&lt;BR /&gt;
| search Job=PROD* &lt;BR /&gt;
| rename Job AS JOB &lt;BR /&gt;
| join type=left JOB [ &lt;BR /&gt;
    search index=ca* sourcetype=uc4 host=uc* U0011502&lt;BR /&gt;
    | stats max(_time) AS Completion_Time by JOB &lt;BR /&gt;
    | eval Completion_Time_A = strftime(Completion_Time, "%+") &lt;BR /&gt;
    | eval Completion_Time_Hour = strftime(Completion_Time, "%H:%M") &lt;BR /&gt;
]  | eval diff = SLA-Completion_Time_Hour  | table CYCLE CheckPoint SLA Completion_Time_A Completion_Time_Hour diff | sort Completion_Time&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 14:34:54 GMT</pubDate>
    <dc:creator>harsush</dc:creator>
    <dc:date>2020-09-29T14:34:54Z</dc:date>
    <item>
      <title>Highlight with color if SLA missed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363364#M160549</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;

&lt;P&gt;Below my search from which i am getting the completion time of job. I need ur help for couple.&lt;/P&gt;

&lt;P&gt;1 - If Below search won't get completion time/Completion_Time_Hour  &amp;gt; SLA time  is there a way to change the cell color.&lt;BR /&gt;
2 - How to calculate time Difference ( SLA  - Completion_Time_Hour )&lt;/P&gt;

&lt;P&gt;eval diff = SLA-Completion_Time_Hour  is now working &lt;/P&gt;

&lt;P&gt;Supported fields : &lt;BR /&gt;
CYCLE,CheckPoint,Job,SLA&lt;BR /&gt;
BAT_A,BAT1,PROD.BAT1.XYZ,10:30&lt;BR /&gt;
BAT_A,BAT2,PROD.BAT2.XYZ,09:30&lt;BR /&gt;
BAT_B,BAT1,PROD.BAT1.XYZ,07:30&lt;BR /&gt;
...&lt;BR /&gt;
...&lt;BR /&gt;
....&lt;/P&gt;

&lt;P&gt;| inputlookup PROD_BOX_CO&lt;BR /&gt;
| search Job=PROD* &lt;BR /&gt;
| rename Job AS JOB &lt;BR /&gt;
| join type=left JOB [ &lt;BR /&gt;
    search index=ca* sourcetype=uc4 host=uc* U0011502&lt;BR /&gt;
    | stats max(_time) AS Completion_Time by JOB &lt;BR /&gt;
    | eval Completion_Time_A = strftime(Completion_Time, "%+") &lt;BR /&gt;
    | eval Completion_Time_Hour = strftime(Completion_Time, "%H:%M") &lt;BR /&gt;
]  | eval diff = SLA-Completion_Time_Hour  | table CYCLE CheckPoint SLA Completion_Time_A Completion_Time_Hour diff | sort Completion_Time&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:34:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363364#M160549</guid>
      <dc:creator>harsush</dc:creator>
      <dc:date>2020-09-29T14:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight with color if SLA missed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363365#M160550</link>
      <description>&lt;P&gt;You can't calculate the time difference between two strings - which is what you get from strftime.&lt;BR /&gt;&lt;BR /&gt;
In order to calculate &lt;CODE&gt;eval diff = SLA-Completion_Time_Hour&lt;/CODE&gt;, both SLA and Completion_Time_Hour should be expressed as epoch time.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;stats max(_time) AS Completion_Time by JOB&lt;/CODE&gt; yields the Completion_Time as epoch_time. I don't know the format of SLA.&lt;/P&gt;

&lt;P&gt;In Splunk 6.6, there are several ways to format a column in the results by clicking on the small paintbrush at the top of the column.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:34:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363365#M160550</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2020-09-29T14:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight with color if SLA missed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363366#M160551</link>
      <description>&lt;P&gt;SLA column is in PROD_BOX_CO&lt;/P&gt;

&lt;P&gt;CYCLE,CheckPoint,Job,SLA&lt;BR /&gt;
BAT_A,BAT1,PROD.BAT1.XYZ,10:30&lt;BR /&gt;
BAT_A,BAT2,PROD.BAT2.XYZ,09:30&lt;BR /&gt;
BAT_B,BAT1,PROD.BAT1.XYZ,07:30&lt;BR /&gt;
...&lt;BR /&gt;
...&lt;BR /&gt;
....&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:35:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363366#M160551</guid>
      <dc:creator>harsush</dc:creator>
      <dc:date>2020-09-29T14:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight with color if SLA missed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363367#M160552</link>
      <description>&lt;P&gt;Yikes - given the format that you shared in a comment, here is what I would do.&lt;BR /&gt;
First, since you have only HH:MM in the csv input, I would calculate the number of minutes since midnight instead of the actual epoch time. My search would be&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup PROD_BOX_CO
| search Job=PROD*
| rename Job AS JOB
| rex field=SLA "(?&amp;lt;hrs&amp;gt;\d+?)\:(?&amp;lt;min&amp;gt;\d+)"
| eval SLA_time_minutes = hrs * 60 + min
| join type=left JOB [ search index=ca* sourcetype=uc4 host=uc* U0011502
        | stats max(_time) AS Completion_Time by JOB
        | eval Completion_Time_A = strftime(Completion_Time, "%+")
        | eval Completion_Time_Hour = strftime(Completion_Time, "%H:%M")
        | eval Completion_time_minutes = strftime(Completion_Time,"%H")*60 + strftime(Completion_Time,"%M") ]
| eval diff = SLA_time_minutes - Completion_time_minutes
| eval diff_formatted = tostring(diff*60,"duration")
| table CYCLE CheckPoint SLA Completion_Time_A Completion_Time_Hour diff diff_formatted
| sort Completion_Time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Jun 2017 19:14:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363367#M160552</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2017-06-26T19:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight with color if SLA missed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363368#M160553</link>
      <description>&lt;P&gt;thanks for the help iguinn. &lt;/P&gt;

&lt;P&gt;Just change a bit and it works fine&lt;/P&gt;

&lt;P&gt;| stats max(_time) AS Completion_Time by JOB&lt;BR /&gt;
| eval CTD = strftime(Completion_Time, "%+")&lt;BR /&gt;
| eval CTH = strftime(Completion_Time, "%H:%M")&lt;BR /&gt;
| eval CTM = tonumber (strftime(Completion_Time,"%H"))*60 + tonumber (strftime(Completion_Time,"%M")) ]&lt;BR /&gt;
| eval ACTUAL(SLAM-CTM) = SLA_time_minutes - CTM&lt;BR /&gt;
| table CYCLE JOB SLA CTD ACTUAL(SLAM-CTM)&lt;BR /&gt;
| sort Completion_Time&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:40:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363368#M160553</guid>
      <dc:creator>harsush</dc:creator>
      <dc:date>2020-09-29T14:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight with color if SLA missed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363369#M160554</link>
      <description>&lt;P&gt;Thanks for your help Iguinn...&lt;/P&gt;

&lt;P&gt;is there a way to covert SLA time to epoch_time&lt;/P&gt;

&lt;P&gt;Suppose in my file SLA format is 10:30 convert it into today's date time. Is this possible  ?&lt;/P&gt;

&lt;P&gt;abv will help me to calculate accurate SLA&lt;/P&gt;

&lt;P&gt;| inputlookup milestonejobs&lt;BR /&gt;
| search CYCLE=ABCD&lt;BR /&gt;
| rex field=SLA "(?\d+?):(?\d+)"&lt;BR /&gt;
| eval SLA_time_minutes = tonumber(hrs) * 60 + min&lt;BR /&gt;
| join type=left JOB [ search index=ca* sourcetype=uc4 host=uc* U0011502 OR U0011006 OR U0012109 OR U0011066 OR U0011037 OR U0011038&lt;BR /&gt;
| rex "U0011502 Workflow '(?[^']+)'" &lt;BR /&gt;
| rex "U0011006 Job '(?[^']+)'" &lt;BR /&gt;
| rex "U0012109 Script '(?[^']+)'"&lt;BR /&gt;
| rex "U0011066 Notification '(?[^']+)'"&lt;BR /&gt;
| rex "U0011037 Event '(?[^']+)'"&lt;BR /&gt;
| rex "U0011038 Event '(?[^']+)'"&lt;BR /&gt;
| stats max(_time) AS Completion_Time by JOB&lt;BR /&gt;
| eval COMPLETION-DATE = strftime(Completion_Time, "%+")&lt;BR /&gt;
| eval CTH = strftime(Completion_Time, "%H:%M")&lt;BR /&gt;
| eval CTM = tonumber (strftime(Completion_Time,"%H"))*60 + tonumber (strftime(Completion_Time,"%M")) ]&lt;BR /&gt;
| eval ACTUAL-SLA-DIFF = SLA_time_minutes - CTM&lt;BR /&gt;
| fillnull value=YET-TO-RUN COMPLETION-DATE ACTUAL-SLA-DIFF &lt;BR /&gt;
| table CYCLE MILE-STONE JOB SLA COMPLETION-DATE ACTUAL-SLA-DIFF &lt;BR /&gt;
| sort COMPLETION-DATE&lt;/P&gt;

&lt;H2&gt;Lookup file name : milestonejobs&lt;/H2&gt;

&lt;P&gt;CYCLE,CheckPoint,Job,SLA&lt;BR /&gt;
BAT_A,BAT1,PROD.BAT1.XYZ,10:30&lt;BR /&gt;
BAT_A,BAT2,PROD.BAT2.XYZ,09:30&lt;BR /&gt;
BAT_B,BAT1,PROD.BAT1.XYZ,07:30&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:47:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363369#M160554</guid>
      <dc:creator>harsush</dc:creator>
      <dc:date>2020-09-29T14:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight with color if SLA missed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363370#M160555</link>
      <description>&lt;P&gt;If you want to convert the SLA time to epoch time, then you will need to assume that the SLA date is "today". This can be calculated as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | rex field=SLA "(?&amp;lt;hrs&amp;gt;\d+?)\:(?&amp;lt;min&amp;gt;\d+)"
 | eval SLA_time_seconds = (hrs * 60 + min) * 60
 | eval midnight_today = relative_time(now(),"@d")
 | eval SLA_epoch_time = midnight_today + SLA_time_seconds
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Jul 2017 05:25:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Highlight-with-color-if-SLA-missed/m-p/363370#M160555</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2017-07-10T05:25:44Z</dc:date>
    </item>
  </channel>
</rss>

