<?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: Create a table with Json data in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701187#M57486</link>
    <description>&lt;P&gt;Hi, &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt; if mvexoand is used the results are truncated and i get a warning message. Any other alternative to mvexpand command is available?&lt;/P&gt;</description>
    <pubDate>Mon, 07 Oct 2024 11:02:50 GMT</pubDate>
    <dc:creator>anooshac</dc:creator>
    <dc:date>2024-10-07T11:02:50Z</dc:date>
    <item>
      <title>Create a table with Json data</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701169#M57479</link>
      <description>&lt;P&gt;I have a JSON data like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"suite":[{"hostname":"localhost","failures":0,"package":"ABC","tests":0,"name":"ABC_test","id":0,"time":0,"errors":0,"testcase":[{"classname":"xyz","name":"foo1","time":0,"status":"Passed"},{"classname":"pqr","name":"foo2)","time":0,"status":"Passed"},....&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a table with Suite testcase_name and Testcase_status as columns. I have a solution using mvexpand command. But when there is large data output gets truncated using mvexpand command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  ....| spath output=suite path=suite{}.name | spath output=Testcase path=suite{}.testcase{}.name| spath output=Error path=suite{}.testcase{}.error | spath output=Status path=suite{}.testcase{}.status|search (suite="*") 
| eval x=mvzip(Testcase,Status)
| mvexpand x|eval y=split(x,",")|eval Testcase=mvindex(y,0) 
| search Testcase IN ("***")
| eval suite=mvdedup(suite)
|eval Status=mvindex(y,1) |table "Suite" "TestCase" Status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the query im using. But the results gets truncated. Is there any alternative for mvexpand so that i can edit the above query ?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 09:51:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701169#M57479</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2024-10-07T09:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with Json data</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701175#M57480</link>
      <description>&lt;P&gt;You example is not correctly formatted JSON. Please provide a valid representative version of your events.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 10:24:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701175#M57480</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-10-07T10:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with Json data</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701179#M57481</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "suite": [
        {
            "hostname": "localhost",
            "failures": 0,
            "package": "ABC",
            "tests": 0,
            "name": "ABC_test",
            "id": 0,
            "time": 0,
            "errors": 0,
            "testcase": [
                {
                    "classname": "xyz",
                    "name": "foo1",
                    "time": 0,
                    "status": "Passed"
                },
                {
                    "classname": "pqr",
                    "name": "foo2",
                    "time": 0,
                    "status": "Passed"
                },
               .
               .
               .
            ]
        }
    ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt; ,Sorry for that, here is the correct formatted JSON data.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 10:42:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701179#M57481</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2024-10-07T10:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with Json data</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701184#M57482</link>
      <description>&lt;P&gt;Splunk functions should _not_ truncate any data on their own (unless you explicitly use some text-manipulation function of course). There might be some visualization issue on the displaying end.&lt;/P&gt;&lt;P&gt;Anyway, You're doing one thing which in case of your data might be giving proper results but in general is a bad practice.&lt;/P&gt;&lt;P&gt;If you have multivalued fields (like your two Testcase and Status fields) you have no guarantee that they will contain entries matching 1-1 with each other.&lt;/P&gt;&lt;P&gt;A simple run-anywhere example to demonstrate:&lt;/P&gt;&lt;PRE&gt;| makeresults&lt;BR /&gt;| eval _raw="[ { \"a\":\"a\",\"b\":\"b\"},{\"a\":\"b\",\"c\":\"c\"},{\"b\":\"d\",\"c\":\"e\"}]"&lt;BR /&gt;| spath {}.a output=a&lt;BR /&gt;| spath {}.b output=b&lt;BR /&gt;| spath {}.c output=c&lt;BR /&gt;| spath {} output=pairs&lt;/PRE&gt;&lt;P&gt;As you can see, the output in fields a, b and c would be completely different if zipped together than what you get as pairs in the array.&lt;/P&gt;&lt;P&gt;That's why you should rather parse out whole separate testcases as json objects with&lt;/P&gt;&lt;PRE&gt;| spath testcase&lt;/PRE&gt;&lt;P&gt;(or whatever path you have there to your test cases)&lt;/P&gt;&lt;P&gt;and then parse each of them separately so you don't loose the connection between separate fields within a single testcase.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 10:53:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701184#M57482</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-10-07T10:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with Json data</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701186#M57485</link>
      <description>&lt;LI-CODE lang="markup"&gt;| spath suite{}.testcase{} output=testcase
| mvexpand testcase
| spath input=testcase
| table name status&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 07 Oct 2024 10:59:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701186#M57485</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-10-07T10:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with Json data</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701187#M57486</link>
      <description>&lt;P&gt;Hi, &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt; if mvexoand is used the results are truncated and i get a warning message. Any other alternative to mvexpand command is available?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 11:02:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701187#M57486</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2024-10-07T11:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with Json data</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701190#M57487</link>
      <description>&lt;P&gt;Hi, &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt; ,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    | spath output=suite path=suite{}.name | spath output=Testcase path=suite{}.testcase{}.name | spath output=Status path=suite{}.testcase{}.status|table suite Testcase  Status&lt;/LI-CODE&gt;&lt;P&gt;I wrote a query like this. but the problem here is in a single row multiple values will come. I want to break these value and print them in different row. Any optionnother than mvexpand?&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 11:40:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701190#M57487</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2024-10-07T11:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with Json data</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701195#M57489</link>
      <description>&lt;P&gt;That's why spath has both input and output options. And yes, you need to mvexpand your results to make each testcase a separate row.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 12:13:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701195#M57489</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-10-07T12:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with Json data</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701197#M57490</link>
      <description>&lt;P&gt;Try removing / reducing unneeded fields before the doing the mvexpand to reduce the memory requirement&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 12:59:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701197#M57490</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-10-07T12:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with Json data</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701199#M57491</link>
      <description>&lt;P&gt;The most significant memory saving could come with doing&lt;/P&gt;&lt;PRE&gt;| fields - _raw&lt;/PRE&gt;&lt;P&gt;If you already have your fields parsed, there's no need to drag the whole huge raw event along.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 13:12:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Create-a-table-with-Json-data/m-p/701199#M57491</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-10-07T13:12:32Z</dc:date>
    </item>
  </channel>
</rss>

