<?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 Re: Timechart woes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552228#M156718</link>
    <description>&lt;P&gt;You don't need the streamstats or eventstats, they were there for a more generic solution rather than the hard-coded BIDOFF jobname. The essential element is to modify the job name for the different runs.&lt;/P&gt;</description>
    <pubDate>Wed, 19 May 2021 15:06:43 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-05-19T15:06:43Z</dc:date>
    <item>
      <title>Timechart woes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552165#M156695</link>
      <description>&lt;P&gt;I've been searching and trying options for a couple of days now with this search and cannot find a solution.&lt;/P&gt;&lt;P&gt;I am using DB Connect to interrogate a database to get events that show me the start and end times for a suite of jobs.&amp;nbsp; This works fine.&amp;nbsp; Each day I have a single event detailing start and end time for each job.&amp;nbsp; However, one of the jobs runs twice.&amp;nbsp; I am trying to create a timechart showing the run time for each job.&amp;nbsp; The job that runs twice gives two results for one day so when the timechart runs, the stats are there, but not the visualisation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sure there must be a simple solution to this, but I can't work it out.&amp;nbsp; Is there a way to get the results to show in a timechart?&amp;nbsp; Thanks in advance&lt;/P&gt;&lt;P&gt;My search -&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=foo sourcetype=bar JobName="BIDOFF" earliest=-7d@d latest=-0d@d+7h&lt;BR /&gt;| eval s=strptime(TimeStarted, "%Y-%m-%d %H:%M:%S.%Q")&lt;BR /&gt;| eval e=strptime(TimeCompleted, "%Y-%m-%d %H:%M:%S.%Q")&lt;BR /&gt;| eval r=(e - s)&lt;BR /&gt;| timechart values(r) by JobName&lt;/P&gt;&lt;P&gt;Results -&amp;nbsp;&lt;/P&gt;&lt;P&gt;_time&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; BIDOFF&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;2021-05-12&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="multivalue-subcell"&gt;32.940000&lt;/DIV&gt;&lt;DIV class="multivalue-subcell"&gt;33.000000&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021-05-13&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="multivalue-subcell"&gt;33.013000&lt;/DIV&gt;&lt;DIV class="multivalue-subcell"&gt;33.034000&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021-05-14&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="multivalue-subcell"&gt;32.907000&lt;/DIV&gt;&lt;DIV class="multivalue-subcell"&gt;33.110000&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021-05-15&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021-05-16&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021-05-17&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="multivalue-subcell"&gt;32.936000&lt;/DIV&gt;&lt;DIV class="multivalue-subcell"&gt;33.030000&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021-05-18&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="multivalue-subcell"&gt;33.077000&lt;/DIV&gt;&lt;DIV class="multivalue-subcell"&gt;34.547000&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 19 May 2021 09:36:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552165#M156695</guid>
      <dc:creator>timrich66</dc:creator>
      <dc:date>2021-05-19T09:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart woes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552168#M156696</link>
      <description>&lt;P&gt;Using values() will give you a multi-value field - where there is more than one value for the same day for the same job, how do you expect to visualise this? The chart is expecting a single value per job per day. Rather than using values(), you could use sum() or max() or avg() depending on what it is you are trying to visualise.&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 09:56:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552168#M156696</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-05-19T09:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart woes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552174#M156697</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp; - thanks - I should have made it clear that I wish to chart both values.&lt;/P&gt;&lt;P&gt;The options&amp;nbsp;&lt;SPAN&gt;sum(), max() and avg() don't work for me.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;I've also tried "mvexpand JobName" but this doesn't help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I can only chart one, the first run at midday is the most important.&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 10:21:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552174#M156697</guid>
      <dc:creator>timrich66</dc:creator>
      <dc:date>2021-05-19T10:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart woes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552177#M156698</link>
      <description>&lt;P&gt;JobName is not the field with the multi-values. Try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| foreach *
    [| mvexpand &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;]&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 19 May 2021 10:38:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552177#M156698</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-05-19T10:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart woes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552184#M156699</link>
      <description>&lt;P&gt;This does not work.&lt;/P&gt;&lt;P&gt;I have tried with the field 'TimeStarted' before the eval statements and also with the field 'r' after the evals.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;index=foo ...&lt;BR /&gt;| foreach *&lt;BR /&gt;[| mvexpand TimeStarted]&lt;BR /&gt;| eval s=strptime(TimeStarted, "%Y-%m-%d %H:%M:%S.%Q")&lt;BR /&gt;| eval e=strptime(TimeCompleted, "%Y-%m-%d %H:%M:%S.%Q")&lt;BR /&gt;| eval r=(e - s)&lt;BR /&gt;| timechart values(r) by JobName&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;AND&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;index=foo ...&lt;BR /&gt;| eval s=strptime(TimeStarted, "%Y-%m-%d %H:%M:%S.%Q")&lt;BR /&gt;| eval e=strptime(TimeCompleted, "%Y-%m-%d %H:%M:%S.%Q")&lt;BR /&gt;| eval r=(e - s)&lt;BR /&gt;| foreach *&lt;BR /&gt;[| mvexpand r]&lt;BR /&gt;| timechart values(r) by JobName&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 11:10:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552184#M156699</guid>
      <dc:creator>timrich66</dc:creator>
      <dc:date>2021-05-19T11:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart woes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552185#M156700</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=foo sourcetype=bar JobName="BIDOFF" earliest=-7d@d latest=-0d@d+7h
| eval s=strptime(TimeStarted, "%Y-%m-%d %H:%M:%S.%Q")
| eval e=strptime(TimeCompleted, "%Y-%m-%d %H:%M:%S.%Q")
| eval r=(e - s)
| timechart values(r) by JobName
| foreach *
    [| mvexpand &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;]&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 19 May 2021 11:16:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552185#M156700</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-05-19T11:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart woes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552193#M156703</link>
      <description>&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I now have a line.&amp;nbsp; What I need to do now is find out how to make it separate lines for each run.&lt;/P&gt;&lt;P&gt;To explain - each day the BIDOFF job runs at 12:00 and 13:00.&amp;nbsp; Ideally, I would like a separate result for each run which then gives a separate line on the timechart.&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 11:43:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552193#M156703</guid>
      <dc:creator>timrich66</dc:creator>
      <dc:date>2021-05-19T11:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart woes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552199#M156706</link>
      <description>&lt;P&gt;Thanks for completing the picture&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| streamstats count as index by _time job
| eventstats count as count by _time job
| eval job=if(count&amp;gt;1,job." ".index."/".count,job)
| chart values(value) as value by _time job&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 19 May 2021 12:37:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552199#M156706</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-05-19T12:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart woes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552226#M156717</link>
      <description>&lt;P&gt;Your suggestion nearly worked, but not quite.&amp;nbsp; I have taken your search and modified it as follows&amp;nbsp; -&lt;/P&gt;&lt;P&gt;index=foo ...&lt;BR /&gt;| rex "Started=\"\d{4}-\d\d-\d\d (?&amp;lt;x&amp;gt;\d{2})"&lt;BR /&gt;| eval s=strptime(TimeStarted, "%Y-%m-%d %H:%M:%S.%Q")&lt;BR /&gt;| eval e=strptime(TimeCompleted, "%Y-%m-%d %H:%M:%S.%Q")&lt;BR /&gt;| eval r=(e - s)&lt;BR /&gt;| streamstats count as index by _time JobName&lt;BR /&gt;| eventstats count as count by _time JobName&lt;BR /&gt;| eval JobName=case(JobName!="BIDOFF",JobName,JobName="BIDOFF" AND x==12,JobName." - midday",JobName="BIDOFF" AND x==13,JobName." - 1pm")&lt;BR /&gt;| chart values(r) as "Run Time" by _time JobName&lt;/P&gt;&lt;P&gt;This works out 'r' (Run Time) and 'x' (the hour the job runs).&amp;nbsp; Then, using a case statement, determines the JobName field based on the hour and the jobname.&amp;nbsp; For job "BIDOFF' the supplemental time based comments are added.&amp;nbsp; For all other jobnames, the name remains the same.&lt;/P&gt;&lt;P&gt;Thank you very much for this.&amp;nbsp; Every day is a learning day &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 15:00:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552226#M156717</guid>
      <dc:creator>timrich66</dc:creator>
      <dc:date>2021-05-19T15:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart woes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552228#M156718</link>
      <description>&lt;P&gt;You don't need the streamstats or eventstats, they were there for a more generic solution rather than the hard-coded BIDOFF jobname. The essential element is to modify the job name for the different runs.&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 15:06:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552228#M156718</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-05-19T15:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart woes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552347#M156762</link>
      <description>&lt;P&gt;Yes, you're right, thanks.&amp;nbsp; It was the 'chart' rather than 'timechart' that made the real difference.&lt;/P&gt;&lt;P&gt;All working as planned.&lt;/P&gt;</description>
      <pubDate>Thu, 20 May 2021 08:37:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-woes/m-p/552347#M156762</guid>
      <dc:creator>timrich66</dc:creator>
      <dc:date>2021-05-20T08:37:21Z</dc:date>
    </item>
  </channel>
</rss>

