<?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: Response Time from Splunk Logs using Transaction starts with and within an single event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484097#M140336</link>
    <description>&lt;P&gt;Hi ,&lt;/P&gt;

&lt;P&gt;Thanks , it does work . I too have another field which comes within the event and I am trying to calculate the duration by that field. My query is below&lt;/P&gt;

&lt;P&gt;index="ereg-prod" | transaction time maxspan=1h startswith="Start : Before Job" endswith="End : After Job" | rex field=source "*/logs/job-(?\S+).log" | table duration, BatchJobName  &lt;/P&gt;

&lt;P&gt;basically I am trying to calculate the duration in HH/MM/SS for the batchjobs and there are some batch jobs which runs hourly and some every 15 min within a hour and how can arrive at the average running duration of these jobs. If I try my search | |  chart values(duration) over _time by BatchJobName will it work. Any suggestions would be helpful. &lt;/P&gt;</description>
    <pubDate>Wed, 29 Apr 2020 17:20:42 GMT</pubDate>
    <dc:creator>sen8sen</dc:creator>
    <dc:date>2020-04-29T17:20:42Z</dc:date>
    <item>
      <title>Response Time from Splunk Logs using Transaction starts with and within an single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484095#M140334</link>
      <description>&lt;P&gt;I am trying to calculate the duration/timetaken between 2 strings in an event using transaction starts with and endswith and it is not giving the expected and the format is different, I wanted a simple format with HH:MM:SS&lt;/P&gt;

&lt;P&gt;Example of event returned : &lt;/P&gt;

&lt;P&gt;[main] 19:28:06,435[batchLogId=, clientCode=] INFO  org.ets.ereg.batch.common.listener.BaseJobListener.beforeJob(BaseJobListener.java:89) - Start : Before Job *************&lt;BR /&gt;
...&lt;BR /&gt;
...&lt;BR /&gt;
...&lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;[main] 20:05:07,411[batchLogId=15304309, clientCode=] INFO  org.ets.ereg.batch.common.listener.BaseJobListener.afterJob(BaseJobListener.java:163) - End : After Job ***********&lt;/P&gt;

&lt;P&gt;My Requirement : &lt;/P&gt;

&lt;P&gt;I wanted to calculate my time taken or duration based on the timings in front of these . Between Start and End After Job. &lt;/P&gt;

&lt;P&gt;My Query is &lt;/P&gt;

&lt;P&gt;index="ereg-prod" source="&lt;EM&gt;jobs.*log&lt;/EM&gt;" | transaction startswith="Start : Before Job" endswith="End : After Job" | rex field=source "/*/logs/job-(?\S+).log" &lt;/P&gt;

&lt;P&gt;I tried time chart and _time what is the exact way to get it. Any suggestions would be helpful.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:09:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484095#M140334</guid>
      <dc:creator>sen8sen</dc:creator>
      <dc:date>2020-09-30T05:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Response Time from Splunk Logs using Transaction starts with and within an single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484096#M140335</link>
      <description>&lt;P&gt;Hello @sen8sen,&lt;/P&gt;

&lt;P&gt;please consult &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.3/SearchReference/Transaction"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.3/SearchReference/Transaction&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;the transaction command adds two fields to the raw events, &lt;STRONG&gt;duration&lt;/STRONG&gt; and eventcount. The values in the duration field show the difference between the timestamps for the first and last events in the transaction. &lt;/P&gt;

&lt;P&gt;So basically the transaction command do it for you already and you can use this field directly:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="ereg-prod" source="jobs.log" | transaction startswith="Start : Before Job" endswith="End : After Job" | rex field=source "//logs/job-(?\S+).log" |table _raw duration
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Apr 2020 07:31:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484096#M140335</guid>
      <dc:creator>PavelP</dc:creator>
      <dc:date>2020-04-29T07:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: Response Time from Splunk Logs using Transaction starts with and within an single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484097#M140336</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;

&lt;P&gt;Thanks , it does work . I too have another field which comes within the event and I am trying to calculate the duration by that field. My query is below&lt;/P&gt;

&lt;P&gt;index="ereg-prod" | transaction time maxspan=1h startswith="Start : Before Job" endswith="End : After Job" | rex field=source "*/logs/job-(?\S+).log" | table duration, BatchJobName  &lt;/P&gt;

&lt;P&gt;basically I am trying to calculate the duration in HH/MM/SS for the batchjobs and there are some batch jobs which runs hourly and some every 15 min within a hour and how can arrive at the average running duration of these jobs. If I try my search | |  chart values(duration) over _time by BatchJobName will it work. Any suggestions would be helpful. &lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 17:20:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484097#M140336</guid>
      <dc:creator>sen8sen</dc:creator>
      <dc:date>2020-04-29T17:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Response Time from Splunk Logs using Transaction starts with and within an single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484098#M140337</link>
      <description>&lt;P&gt;Hi @sen8sen, &lt;/P&gt;

&lt;P&gt;try to build your transactions based on a uniq common field (BatchJobName):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index="ereg-prod" | transaction BatchJobName time maxspan=1h startswith="Start : Before Job" endswith="End : After Job" | rex field=source "*/logs/job-(?\S+).log" | table duration, BatchJobName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;BTW: what you try to achive/extract with your rex command? Your rex command missing a named caputring group, see &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.3/SearchReference/Rex"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.3/SearchReference/Rex&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 19:46:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484098#M140337</guid>
      <dc:creator>PavelP</dc:creator>
      <dc:date>2020-04-29T19:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Response Time from Splunk Logs using Transaction starts with and within an single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484099#M140338</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;

&lt;P&gt;here is my query &lt;/P&gt;

&lt;P&gt;index="ereg-prod" source="/export/Apps/ereg-prod/batch/archive/&lt;EM&gt;.*log&lt;/EM&gt;" | transaction time startswith="Start : Before Job" endswith="End : After Job" | rex field=source "ereg-prod/batch/archive/logs/job-(?\S+).log" | rex field=source "ereg-prod/batch/archive/logs/job-(?\S+).log" | chart avg(duration) as "Duration in Seconds"  by BatchJobName&lt;/P&gt;

&lt;P&gt;It is returning the results but the unable to format for HH:MM:SS which would be useful. Would it be possible to achieve that&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:10:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484099#M140338</guid>
      <dc:creator>sen8sen</dc:creator>
      <dc:date>2020-09-30T05:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Response Time from Splunk Logs using Transaction starts with and within an single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484100#M140339</link>
      <description>&lt;P&gt;Hello @sen8sen,&lt;/P&gt;

&lt;P&gt;sure, check this answer: &lt;A href="https://answers.splunk.com/answers/61652/convert-seconds-into-hours-minutes-and-seconds.html"&gt;https://answers.splunk.com/answers/61652/convert-seconds-into-hours-minutes-and-seconds.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 10:08:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484100#M140339</guid>
      <dc:creator>PavelP</dc:creator>
      <dc:date>2020-04-30T10:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: Response Time from Splunk Logs using Transaction starts with and within an single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484101#M140340</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;

&lt;P&gt;thanks a lot -:) &lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 18:00:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Response-Time-from-Splunk-Logs-using-Transaction-starts-with-and/m-p/484101#M140340</guid>
      <dc:creator>sen8sen</dc:creator>
      <dc:date>2020-04-30T18:00:11Z</dc:date>
    </item>
  </channel>
</rss>

