<?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 How to extract field as time in ms after occurrence of a string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-as-time-in-ms-after-occurrence-of-a-string/m-p/567942#M197928</link>
    <description>&lt;P&gt;Here is a log example -&amp;nbsp;&lt;/P&gt;&lt;TABLE width="776px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="775px"&gt;&lt;DIV class="shared-eventsviewer-shared-rawfield"&gt;&lt;DIV class="raw-event normal  wrap "&gt;{"&lt;SPAN class="t"&gt;log_time&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;2021-08-27T07:16:46.178275260&lt;/SPAN&gt;+&lt;SPAN class="t"&gt;00:00&lt;/SPAN&gt;","&lt;SPAN class="t"&gt;output&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;stdout&lt;/SPAN&gt;","&lt;SPAN class="t"&gt;log&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;2021-08-27&lt;/SPAN&gt; &lt;SPAN class="t"&gt;07:16:46.178&lt;/SPAN&gt; [&lt;SPAN class="t"&gt;INFO&lt;/SPAN&gt; ] [&lt;SPAN class="t"&gt;her-49&lt;/SPAN&gt;] &lt;SPAN class="t"&gt;a.a.ActorSystemImpl&lt;/SPAN&gt; &lt;SPAN class="t"&gt;-&lt;/SPAN&gt; &lt;SPAN class="t"&gt;Logged&lt;/SPAN&gt; &lt;SPAN class="t"&gt;Request:HttpMethod&lt;/SPAN&gt;(&lt;SPAN class="t"&gt;POST&lt;/SPAN&gt;)&lt;SPAN class="t"&gt;:&lt;A href="http://id-manager-test.api-gateway.sit.ls.api.com/repos/hrn:idmrepo-sit::ol:idm_team_internal_test/ids/" target="_blank" rel="noopener"&gt;http://id-test.api-gateway.sit.ls.api.com/repos/hrn:idmrepo-sit::ol:idm_team_internal_test/ids/&lt;/A&gt;&lt;SPAN class="t a"&gt;getOrCreate&lt;/SPAN&gt;/bulk&lt;/SPAN&gt;?&lt;SPAN class="t"&gt;streaming=true&lt;/SPAN&gt;&amp;amp;&lt;SPAN class="t"&gt;dscid=GvaIrM-cb4005f6-a828-4fd7-9f54-6082e2912716:200&lt;/SPAN&gt; &lt;SPAN class="t"&gt;OK:&lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/SPAN&gt;","&lt;SPAN class="t"&gt;k8scluster&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;borg-dev-1-aws-west-1&lt;/SPAN&gt;","&lt;SPAN class="t"&gt;namespace&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"*","&lt;SPAN class="t"&gt;env&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;DEV&lt;/SPAN&gt;","&lt;SPAN class="t"&gt;app_time&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"","&lt;SPAN class="t"&gt;time&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;1630048606.178275260&lt;/SPAN&gt;"}&lt;/DIV&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to extract the digits after "OK:" (here highlighted in red color) as time in ms.&amp;nbsp;&lt;BR /&gt;I am just started using splunk. I am trying this -&amp;nbsp;&lt;/P&gt;&lt;P&gt;rex "([^\:]+$)(?P&amp;lt;duration&amp;gt;.+)" | stats exactperc98(duration) as P98 avg(duration) as AVG by log&lt;/P&gt;&lt;P&gt;But this is not working.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Sep 2021 04:32:45 GMT</pubDate>
    <dc:creator>ashvini_mishra</dc:creator>
    <dc:date>2021-09-22T04:32:45Z</dc:date>
    <item>
      <title>How to extract field as time in ms after occurrence of a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-as-time-in-ms-after-occurrence-of-a-string/m-p/567942#M197928</link>
      <description>&lt;P&gt;Here is a log example -&amp;nbsp;&lt;/P&gt;&lt;TABLE width="776px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="775px"&gt;&lt;DIV class="shared-eventsviewer-shared-rawfield"&gt;&lt;DIV class="raw-event normal  wrap "&gt;{"&lt;SPAN class="t"&gt;log_time&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;2021-08-27T07:16:46.178275260&lt;/SPAN&gt;+&lt;SPAN class="t"&gt;00:00&lt;/SPAN&gt;","&lt;SPAN class="t"&gt;output&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;stdout&lt;/SPAN&gt;","&lt;SPAN class="t"&gt;log&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;2021-08-27&lt;/SPAN&gt; &lt;SPAN class="t"&gt;07:16:46.178&lt;/SPAN&gt; [&lt;SPAN class="t"&gt;INFO&lt;/SPAN&gt; ] [&lt;SPAN class="t"&gt;her-49&lt;/SPAN&gt;] &lt;SPAN class="t"&gt;a.a.ActorSystemImpl&lt;/SPAN&gt; &lt;SPAN class="t"&gt;-&lt;/SPAN&gt; &lt;SPAN class="t"&gt;Logged&lt;/SPAN&gt; &lt;SPAN class="t"&gt;Request:HttpMethod&lt;/SPAN&gt;(&lt;SPAN class="t"&gt;POST&lt;/SPAN&gt;)&lt;SPAN class="t"&gt;:&lt;A href="http://id-manager-test.api-gateway.sit.ls.api.com/repos/hrn:idmrepo-sit::ol:idm_team_internal_test/ids/" target="_blank" rel="noopener"&gt;http://id-test.api-gateway.sit.ls.api.com/repos/hrn:idmrepo-sit::ol:idm_team_internal_test/ids/&lt;/A&gt;&lt;SPAN class="t a"&gt;getOrCreate&lt;/SPAN&gt;/bulk&lt;/SPAN&gt;?&lt;SPAN class="t"&gt;streaming=true&lt;/SPAN&gt;&amp;amp;&lt;SPAN class="t"&gt;dscid=GvaIrM-cb4005f6-a828-4fd7-9f54-6082e2912716:200&lt;/SPAN&gt; &lt;SPAN class="t"&gt;OK:&lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/SPAN&gt;","&lt;SPAN class="t"&gt;k8scluster&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;borg-dev-1-aws-west-1&lt;/SPAN&gt;","&lt;SPAN class="t"&gt;namespace&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"*","&lt;SPAN class="t"&gt;env&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;DEV&lt;/SPAN&gt;","&lt;SPAN class="t"&gt;app_time&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"","&lt;SPAN class="t"&gt;time&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;"&lt;SPAN class="t"&gt;1630048606.178275260&lt;/SPAN&gt;"}&lt;/DIV&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to extract the digits after "OK:" (here highlighted in red color) as time in ms.&amp;nbsp;&lt;BR /&gt;I am just started using splunk. I am trying this -&amp;nbsp;&lt;/P&gt;&lt;P&gt;rex "([^\:]+$)(?P&amp;lt;duration&amp;gt;.+)" | stats exactperc98(duration) as P98 avg(duration) as AVG by log&lt;/P&gt;&lt;P&gt;But this is not working.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 04:32:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-as-time-in-ms-after-occurrence-of-a-string/m-p/567942#M197928</guid>
      <dc:creator>ashvini_mishra</dc:creator>
      <dc:date>2021-09-22T04:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract field as time in ms after occurrence of a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-as-time-in-ms-after-occurrence-of-a-string/m-p/567953#M197929</link>
      <description>&lt;P&gt;It's always best if you have the whole event parsed so you don't accidentaly hit some unexpected string occurrence in other part of the event. But anyway, it should be quite simple&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "OK:(?&amp;lt;duration&amp;gt;\d+)\"" | &amp;lt;&amp;lt;your stats&amp;gt;&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 22 Sep 2021 05:57:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-as-time-in-ms-after-occurrence-of-a-string/m-p/567953#M197929</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-22T05:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract field as time in ms after occurrence of a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-as-time-in-ms-after-occurrence-of-a-string/m-p/567961#M197933</link>
      <description>&lt;P&gt;Given that you appear to have a field name 'log' already, which is the data from your JSON example, then if that's the field you need to extract duration from, then&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=log "OK:(?&amp;lt;duration&amp;gt;\d+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that if the encapsulated log didn't result in a 200 OK response, then of course this will not work&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 06:40:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-field-as-time-in-ms-after-occurrence-of-a-string/m-p/567961#M197933</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-09-22T06:40:23Z</dc:date>
    </item>
  </channel>
</rss>

