<?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 create a custom table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-custom-table/m-p/348906#M103277</link>
    <description>&lt;P&gt;I think, you should be able to get your requirements meet with the answer from @cusello. However,  In case you want to build custom dashboard you can consider using java script. &lt;/P&gt;

&lt;P&gt;On the dashboard page you need to add your query with search tag.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search id="cluster_details"&amp;gt;
    &amp;lt;query&amp;gt;index= main sourcetype="data" | table hostname cluster_status&amp;lt;/query&amp;gt;
  &amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then add a panel in the dashboard like following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Table View&amp;lt;/title&amp;gt;
      &amp;lt;html&amp;gt;
          &amp;lt;div id="table_data"&amp;gt;&amp;lt;/div&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;

  &amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the JS , you need to fetch the results from the search query and prepare the table output as per your requirement.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;function(mvc, SingleView, SearchManager) {
    var search_investigation = mvc.Components.get("table_data");
    if(search_pce_status){
        var abc = abc.data("results");
        search_pce_result.on("data",function(){
            console.log("In Data");
            if(abc.hasData()){
                var numRows = (abc.data().rows).length;
                console.log(numRows);
                var id = document.getElementById('pce_service_status');
                for(var index=0; index&amp;lt;numRows; index++){ 
                    create_service_div(id,"Not Running",abc.data().rows[index][0],"rgb(217, 63, 60);");
                    create_service_div(id,"Optional",abc.data().rows[index][2],"grey");
                    create_service_div(id,"Partial",abc.data().rows[index][1],"rgb(247, 188, 56);");
                    create_service_div(id,"Running",abc.data().rows[index][3],"rgb(101, 166, 55);");
                    create_service_div(id,"Unknown",abc.data().rows[index][4],"grey");

                }
            }
        });

        function create_service_div(parent,label,value,color){
    var col = document.createElement("div");
    col.setAttribute("class","css-class");
    var heading = document.createElement("div");
    heading.innerHTML = '&amp;lt;p class="css__font" style="color:'+color+'"&amp;gt;'+label+':'+value+'&amp;lt;/p&amp;gt;';      
    col.appendChild(heading);
    parent.appendChild(col);
}  

}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 02 Nov 2017 11:47:18 GMT</pubDate>
    <dc:creator>hardikJsheth</dc:creator>
    <dc:date>2017-11-02T11:47:18Z</dc:date>
    <item>
      <title>How to create a custom table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-custom-table/m-p/348904#M103275</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I want to create a table similar to the picture below, I have tried the table command but I can't seem to make it work. Is there any way? I also checked if I can work around the heatmap visualization but cannot seem to make it work. Any help is appreciated&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3796i2D25ED564CC33CED/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 07:32:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-custom-table/m-p/348904#M103275</guid>
      <dc:creator>jannsenagustin</dc:creator>
      <dc:date>2017-11-02T07:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a custom table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-custom-table/m-p/348905#M103276</link>
      <description>&lt;P&gt;Hi jannsenagustin,&lt;BR /&gt;
To have the visualization you like, you have to build your search, something like this example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_* earliest=-1h@h latest=@h | chart count over index by date_minute limit=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Otherwise, did you already seen in the Splunk 7.x Dashboard Examples? there is the Calendar Heatmap Visualization.&lt;BR /&gt;
Or the Calendar Visualization app (downloadable from apps.splunk.com) that could be useful for you.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 08:34:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-custom-table/m-p/348905#M103276</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-11-02T08:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a custom table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-custom-table/m-p/348906#M103277</link>
      <description>&lt;P&gt;I think, you should be able to get your requirements meet with the answer from @cusello. However,  In case you want to build custom dashboard you can consider using java script. &lt;/P&gt;

&lt;P&gt;On the dashboard page you need to add your query with search tag.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search id="cluster_details"&amp;gt;
    &amp;lt;query&amp;gt;index= main sourcetype="data" | table hostname cluster_status&amp;lt;/query&amp;gt;
  &amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then add a panel in the dashboard like following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Table View&amp;lt;/title&amp;gt;
      &amp;lt;html&amp;gt;
          &amp;lt;div id="table_data"&amp;gt;&amp;lt;/div&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;

  &amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the JS , you need to fetch the results from the search query and prepare the table output as per your requirement.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;function(mvc, SingleView, SearchManager) {
    var search_investigation = mvc.Components.get("table_data");
    if(search_pce_status){
        var abc = abc.data("results");
        search_pce_result.on("data",function(){
            console.log("In Data");
            if(abc.hasData()){
                var numRows = (abc.data().rows).length;
                console.log(numRows);
                var id = document.getElementById('pce_service_status');
                for(var index=0; index&amp;lt;numRows; index++){ 
                    create_service_div(id,"Not Running",abc.data().rows[index][0],"rgb(217, 63, 60);");
                    create_service_div(id,"Optional",abc.data().rows[index][2],"grey");
                    create_service_div(id,"Partial",abc.data().rows[index][1],"rgb(247, 188, 56);");
                    create_service_div(id,"Running",abc.data().rows[index][3],"rgb(101, 166, 55);");
                    create_service_div(id,"Unknown",abc.data().rows[index][4],"grey");

                }
            }
        });

        function create_service_div(parent,label,value,color){
    var col = document.createElement("div");
    col.setAttribute("class","css-class");
    var heading = document.createElement("div");
    heading.innerHTML = '&amp;lt;p class="css__font" style="color:'+color+'"&amp;gt;'+label+':'+value+'&amp;lt;/p&amp;gt;';      
    col.appendChild(heading);
    parent.appendChild(col);
}  

}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Nov 2017 11:47:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-custom-table/m-p/348906#M103277</guid>
      <dc:creator>hardikJsheth</dc:creator>
      <dc:date>2017-11-02T11:47:18Z</dc:date>
    </item>
  </channel>
</rss>

