<?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: How to extract integer value in search from string JSON in log event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471286#M132588</link>
    <description>&lt;P&gt;you timechart should work ok on the timeTaken field ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | makeresults count=1 
    | eval data="2020-02-12 17:50:15.228  INFO 1 --- [io-8080-exec-45] c.m.v.c.RequestInterceptor         : {\"logType\":\"RESPONS\",\"traceId\":\"03927a51-23d6-4530-a0e6-112b6d4b5539\",\"timestamp\":\"Feb 12, 2020 5:50:15 PM\",\"requestMethod\":\"GET\",\"requestUrl\":\"http://my.url\",\"responseStatus\":500,\"timeTaken\":28}\""
    | rex field=data "^([^{]+)(?P&amp;lt;json&amp;gt;.+})\"$"
    | spath input=json
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 08 Mar 2020 14:20:09 GMT</pubDate>
    <dc:creator>Esky73</dc:creator>
    <dc:date>2020-03-08T14:20:09Z</dc:date>
    <item>
      <title>How to extract integer value in search from string JSON in log event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471280#M132582</link>
      <description>&lt;P&gt;I am trying to extract 'timeTaken' value from json inside a log event string in order to build a dashboard.&lt;/P&gt;

&lt;P&gt;Example log value:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2020-02-12 17:50:15.228  INFO 1 --- [io-8080-exec-45] c.m.v.c.RequestInterceptor         : {"logType":"RESPONSE","traceId":"03927a51-23d6-4530-a0e6-112b6d4b5539","timestamp":"Feb 12, 2020 5:50:15 PM","requestMethod":"GET","requestUrl":"http://my.url","responseStatus":500,"timeTaken":28}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Search example :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = "my_cluster_name" "kubernetes.labels.app"=my.app | spath log | search log="*"timeTaken"" | rex field=_raw ""timeTaken":(?&amp;lt;timeTaken&amp;gt;.*)}" | timechart span=60s avg(timeTaken)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I also tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = "my_cluster_name" "kubernetes.labels.app"=my.app | spath log | search log="*"timeTaken"" | rex field=_raw "timeTaken\":(?&amp;lt;timeTaken&amp;gt;.*)}" | timechart span=60s avg(timeTaken)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It appears that the value for &lt;CODE&gt;timeTaken&lt;/CODE&gt; is not populated. I would be grateful for any guidance. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 18:11:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471280#M132582</guid>
      <dc:creator>soshua</dc:creator>
      <dc:date>2020-02-12T18:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract integer value in search from string JSON in log event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471281#M132583</link>
      <description>&lt;P&gt;Your log is not in pure json format (some header text are available before json starts). Give this a try (extracting json part and running spath on that)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = "my_cluster_name" "kubernetes.labels.app"=my.app  | rex "^([^\{]+)(?&amp;lt;jsonpart&amp;gt;.+)" | spath input=jsonpart | timechart span=60s avg(timeTaken)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Feb 2020 19:58:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471281#M132583</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-02-12T19:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract integer value in search from string JSON in log event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471282#M132584</link>
      <description>&lt;P&gt;Still doesn't work. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;timechart span=60s avg(timeTaken)&lt;/CODE&gt; -- is this how I would reference jsonpart.timeTaken? &lt;/P&gt;

&lt;P&gt;I tried &lt;CODE&gt;timechart span=60s avg(timeTaken)&lt;/CODE&gt; as well as &lt;CODE&gt;timechart span=60s avg(jsonpart.timeTaken)&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 20:07:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471282#M132584</guid>
      <dc:creator>soshua</dc:creator>
      <dc:date>2020-02-12T20:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract integer value in search from string JSON in log event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471283#M132585</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index = "my_cluster_name" "kubernetes.labels.app"=my.app "timeTaken"
| rex "timeTaken.*?(?&amp;lt;timeTaken&amp;gt;\d+)" 
| timechart span=60s avg(timeTaken)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;spath&lt;/CODE&gt; is not need.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 21:33:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471283#M132585</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-12T21:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract integer value in search from string JSON in log event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471284#M132586</link>
      <description>&lt;P&gt;Solution:&lt;BR /&gt;
&lt;CODE&gt;index = "my_cluster_name" "kubernetes.labels.app"=my.app | spath log | search log="*"timeTaken"" | rex field=log "(?&amp;lt;time&amp;gt;(?&amp;lt;=timeTaken\":)(.\d?))" | timechart span=60s avg(time) as avgTime&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 21:51:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471284#M132586</guid>
      <dc:creator>soshua</dc:creator>
      <dc:date>2020-02-12T21:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract integer value in search from string JSON in log event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471285#M132587</link>
      <description>&lt;P&gt;have you try my answer?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 22:13:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471285#M132587</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-12T22:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract integer value in search from string JSON in log event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471286#M132588</link>
      <description>&lt;P&gt;you timechart should work ok on the timeTaken field ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | makeresults count=1 
    | eval data="2020-02-12 17:50:15.228  INFO 1 --- [io-8080-exec-45] c.m.v.c.RequestInterceptor         : {\"logType\":\"RESPONS\",\"traceId\":\"03927a51-23d6-4530-a0e6-112b6d4b5539\",\"timestamp\":\"Feb 12, 2020 5:50:15 PM\",\"requestMethod\":\"GET\",\"requestUrl\":\"http://my.url\",\"responseStatus\":500,\"timeTaken\":28}\""
    | rex field=data "^([^{]+)(?P&amp;lt;json&amp;gt;.+})\"$"
    | spath input=json
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 08 Mar 2020 14:20:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-integer-value-in-search-from-string-JSON-in-log/m-p/471286#M132588</guid>
      <dc:creator>Esky73</dc:creator>
      <dc:date>2020-03-08T14:20:09Z</dc:date>
    </item>
  </channel>
</rss>

