<?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: Help generating table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707651#M239330</link>
    <description>&lt;P&gt;Thank you! Works well.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Thulasiraman_0-1735337549905.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/33955i7D3F223738A9908E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Thulasiraman_0-1735337549905.png" alt="Thulasiraman_0-1735337549905.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm struggling to get the last date value to calculate the percentage deviation. Could you please help&lt;/P&gt;</description>
    <pubDate>Fri, 27 Dec 2024 22:13:33 GMT</pubDate>
    <dc:creator>Thulasiraman</dc:creator>
    <dc:date>2024-12-27T22:13:33Z</dc:date>
    <item>
      <title>Help generating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707438#M239287</link>
      <description>&lt;P&gt;I'm new to Splunk and trying to display table in the below format after reading data from json. Could someone help me with the splunk query.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Transaction Name&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;pct2ResTime&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Transaction 1&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;&amp;nbsp;4198&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;Transaction 2&lt;/TD&gt;&lt;TD height="25px"&gt;1318&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;Transaction 3&lt;/TD&gt;&lt;TD height="25px"&gt;451&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;JSON file name: statistics.json&lt;/P&gt;&lt;P class=""&gt;{&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;“Transaction1” : {&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"transaction" : "Transaction1”,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"pct1ResTime" : 3083.0,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"pct2ResTime" : 4198.0,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"pct3ResTime" : 47139.0&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;},&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;"Transaction2” : {&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"transaction" : "Transaction2”,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"pct1ResTime" : 1151.3000000000002,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"pct2ResTime" : 1318.8999999999996,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"pct3ResTime" : 6866.0&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;},&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;"Transaction3” : {&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"transaction" : "Transaction3”,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"pct1ResTime" : 342.40000000000003,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"pct2ResTime" : 451.49999999999983,&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"pct3ResTime" : 712.5799999999997&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;&lt;P class=""&gt;}&lt;/P&gt;</description>
      <pubDate>Sun, 22 Dec 2024 05:32:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707438#M239287</guid>
      <dc:creator>Thulasiraman</dc:creator>
      <dc:date>2024-12-22T05:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help generating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707444#M239288</link>
      <description>&lt;P&gt;Have you tried using spath?&lt;/P&gt;</description>
      <pubDate>Sun, 22 Dec 2024 13:35:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707444#M239288</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-12-22T13:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help generating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707445#M239289</link>
      <description>&lt;P&gt;It is possible to use props.conf settings on your indexer machines to pre-process the JSON into distinct events for each transaction, but I will assume that you instead have that one json object as a single event in Splunk.&lt;/P&gt;&lt;P&gt;You can then use the following search:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;Your search for finding the json event&amp;gt;
``` Chop off the first and last brackets ```
| rex field=_raw mode=sed "s/^{//"
| rex field=_raw mode=sed "s/}$//"
``` Add a "SplitHere" keyword to target with a makemv command ```
| rex field=_raw mode=sed "s/},/},SPLITHERE/g" max_match=99
``` Remove the Transaction1 etc. labels for each sub-object ```
| rex field=_raw mode=sed "s/\s*\"Transaction\d*\"\s:\s//g" max_match=99
``` To avoid making _raw a multivalue lets eval it to the "a" field ```
| eval a = _raw
``` Split 'a' into multiple values and table it ```
| makemv a delim=",SPLITHERE"
| mvexpand a
| table a
``` Extract the key values for each json object ```
| spath input=a
``` Filter to desired fields and make it into final table with renaming and rounding ```
| table transaction pct2ResTime
| rename transaction as "Transaction Name"
| eval pct2ResTime = round(pct2ResTime)&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 22 Dec 2024 14:17:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707445#M239289</guid>
      <dc:creator>marnall</dc:creator>
      <dc:date>2024-12-22T14:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help generating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707449#M239290</link>
      <description>&lt;P&gt;No! I did not try with spath. Query i tried so far is below. Also,&amp;nbsp; Could you please help with spath, I'm very new to splunk&lt;BR /&gt;&lt;BR /&gt;index=jenkins_artifact source="&amp;lt;path to json&amp;gt;/statistics.json"&lt;BR /&gt;| rex max_match=0 "(?&amp;lt;keyvalue&amp;gt;\"[^\"]+\":\"[^\"]+\")"&lt;BR /&gt;| mvexpand keyvalue&lt;BR /&gt;| rex field=keyvalue "\"(?&amp;lt;key&amp;gt;[^\"]+)\":\"(?&amp;lt;value&amp;gt;[^\"]+)\""&lt;BR /&gt;| eval {key}=value&lt;BR /&gt;| fields - keyvalue key value _raw host eventtype index linecount source sourcetype punct splunk_server tag tag::eventtype timestamp&lt;BR /&gt;| untable date Transaction pct2ResTime | where like(Transaction,"%__%")&lt;BR /&gt;| xyseries Transaction date pct2ResTime&lt;/P&gt;</description>
      <pubDate>Sun, 22 Dec 2024 16:40:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707449#M239290</guid>
      <dc:creator>Thulasiraman</dc:creator>
      <dc:date>2024-12-22T16:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help generating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707450#M239291</link>
      <description>&lt;P&gt;Thank you for your help! but I'm unable to produce the table with this query.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Dec 2024 16:41:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707450#M239291</guid>
      <dc:creator>Thulasiraman</dc:creator>
      <dc:date>2024-12-22T16:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Help generating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707451#M239292</link>
      <description>&lt;P&gt;Assuming your event are as you have shown, you could do this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath
| table _time *.pct2ResTime
| untable _time transaction pct2ResTime
| eval "Transaction Name"=mvindex(split(transaction,"."),0)
| table "Transaction Name" pct2ResTime&lt;/LI-CODE&gt;&lt;P&gt;If not, please share a more accurate representation of your events, preferably in a code block (as above) to preserve the formatting of the data.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Dec 2024 18:11:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707451#M239292</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-12-22T18:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help generating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707452#M239293</link>
      <description>&lt;P&gt;Can you paste a copy of your original event in a code sample format? Perhaps one of the double-quotes is wrong.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Dec 2024 19:52:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707452#M239293</guid>
      <dc:creator>marnall</dc:creator>
      <dc:date>2024-12-22T19:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help generating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707461#M239295</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;is correct. &amp;nbsp;You should not use regex with JSON which contains structured data. &amp;nbsp;In fact, you also do not need spath with raw events because Splunk by default does that. &amp;nbsp;So, you can use untable directly.&lt;/P&gt;&lt;P&gt;A more semantic implementation of your intentions is to use JSON functions introduced in 8.2:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=jenkins_artifact source="&amp;lt;path to json&amp;gt;/statistics.json"
| eval Transaction_type = json_keys(_raw)
| foreach mode=json_array Transaction_type
    [eval jsonTrans = mvappend(jsonTrans, json_object("Transaction Name", &amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;, "pct2ResTime", json_extract(_raw, &amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt; . ".pct2ResTime")))]
| fields - _raw Transaction*
| mvexpand jsonTrans
| spath input=jsonTrans
| fields - json*&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is an emulation of your mock data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw = "{

  \"Transaction1\" : {

    \"transaction\" : \"Transaction1\",

    \"pct1ResTime\" : 3083.0,

    \"pct2ResTime\" : 4198.0,

    \"pct3ResTime\" : 47139.0

  },

  \"Transaction2\" : {

    \"transaction\" : \"Transaction2\",

    \"pct1ResTime\" : 1151.3000000000002,

    \"pct2ResTime\" : 1318.8999999999996,

    \"pct3ResTime\" : 6866.0

  },

  \"Transaction3\" : {

    \"transaction\" : \"Transaction3\",

    \"pct1ResTime\" : 342.40000000000003,

    \"pct2ResTime\" : 451.49999999999983,

    \"pct3ResTime\" : 712.5799999999997

  }

}"
| spath
``` the above emulates
index=jenkins_artifact source="&amp;lt;path to json&amp;gt;/statistics.json"
```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output is&lt;/P&gt;&lt;TABLE width="338px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="159.6875px"&gt;Transaction Name&lt;/TD&gt;&lt;TD width="177.3125px"&gt;pct2ResTime&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="159.6875px"&gt;Transaction1&lt;/TD&gt;&lt;TD width="177.3125px"&gt;4198&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="159.6875px"&gt;Transaction2&lt;/TD&gt;&lt;TD width="177.3125px"&gt;1318.8999999999996&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="159.6875px"&gt;Transaction3&lt;/TD&gt;&lt;TD width="177.3125px"&gt;451.49999999999983&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Dec 2024 22:07:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707461#M239295</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-12-22T22:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help generating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707470#M239300</link>
      <description>&lt;P&gt;Hey, OP!&amp;nbsp; This is the correct answer.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 02:40:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707470#M239300</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2024-12-23T02:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help generating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707590#M239312</link>
      <description>&lt;P&gt;I did attach the query what i tried and screenshots of how i makeresults and how json files look like.&lt;BR /&gt;&lt;BR /&gt;Basically, I would like to compare today's 95th percentile with previous day or some other day 95th percentile to check for deviation. Also, this json file has been generated by jmeter file using jtl file. Please let me know if you know any way to generate the report in splunk using jtl file&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=jenkins_artifact source="job/V8_JMeter_Load_Test_STAGE_Pipeline/*/src/TestResults/*/JMeter/RUN2/statistics.json" 
| spath 
| eval date = strftime(_time, "%m-%d %k:%M") 
| eval "Transaction Name"=mvindex(split(transaction,"."),0)  
| eval pct2ResTime = round(pct2ResTime) 
| untable  date "Transaction Name" pct2ResTime
| xyseries  "Transaction Name" date pct2ResTime&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Thulasiraman_0-1735239712826.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/33946iEB21B015843C1165/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Thulasiraman_0-1735239712826.png" alt="Thulasiraman_0-1735239712826.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Thulasiraman_1-1735239736490.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/33947i9E928EAA72995F23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Thulasiraman_1-1735239736490.png" alt="Thulasiraman_1-1735239736490.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Thulasiraman_2-1735239756893.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/33948i4606F6F67009020F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Thulasiraman_2-1735239756893.png" alt="Thulasiraman_2-1735239756893.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Dec 2024 19:07:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707590#M239312</guid>
      <dc:creator>Thulasiraman</dc:creator>
      <dc:date>2024-12-26T19:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help generating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707615#M239315</link>
      <description>&lt;P&gt;It appears you have multiple stats for the same transaction in the event . try using mvdedup&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath
| eval date=strftime(_time,"%m-%d %k:%M")
| table date *.pct2ResTime
| foreach *.pct2ResTime
    [| eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = mvdedup('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')]
| untable date transaction pct2ResTime
| eval "Transaction Name"=mvindex(split(transaction,"."),0)
| xyseries "Transaction Name" date pct2ResTime&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 27 Dec 2024 09:59:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707615#M239315</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-12-27T09:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help generating table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707651#M239330</link>
      <description>&lt;P&gt;Thank you! Works well.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Thulasiraman_0-1735337549905.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/33955i7D3F223738A9908E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Thulasiraman_0-1735337549905.png" alt="Thulasiraman_0-1735337549905.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm struggling to get the last date value to calculate the percentage deviation. Could you please help&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2024 22:13:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-generating-table/m-p/707651#M239330</guid>
      <dc:creator>Thulasiraman</dc:creator>
      <dc:date>2024-12-27T22:13:33Z</dc:date>
    </item>
  </channel>
</rss>

