<?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: Changing Display columns depending on sourcetype in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425834#M28054</link>
    <description>&lt;P&gt;It's not working &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; . It just displays the events. I want to display it in the table.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Aug 2018 13:26:51 GMT</pubDate>
    <dc:creator>praspai</dc:creator>
    <dc:date>2018-08-24T13:26:51Z</dc:date>
    <item>
      <title>Changing Display columns depending on sourcetype</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425832#M28052</link>
      <description>&lt;P&gt;In Dashboard depending on sourcetype selected in the dropdown list, we want to display different fields on the dashboard. Since fields can change in the future we have created a lookup for it. So depending on source type the lookup should be queried and get the display columns. I am trying something like below but doesn't seem to work&lt;/P&gt;

&lt;P&gt;index=test sourcetype="XXX"|table [|inputlookup SourceType-Attributes sourcetype="XXX" | fields Attribute]&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 12:49:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425832#M28052</guid>
      <dc:creator>praspai</dc:creator>
      <dc:date>2018-08-24T12:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Display columns depending on sourcetype</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425833#M28053</link>
      <description>&lt;P&gt;@praspai,&lt;/P&gt;

&lt;P&gt;Try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=nirds sourcetype="XXX"|lookup SourceType-Attributes sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;provided sourcetype is a column inside the lookup.&lt;/P&gt;

&lt;P&gt;Below is a run anywhere example. Here we select Argentina to create a dummy search and lookup against the lookup file&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup geo_attr_countries.csv|search country="Argentina"|lookup geo_attr_countries.csv country
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Aug 2018 13:06:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425833#M28053</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-08-24T13:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Display columns depending on sourcetype</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425834#M28054</link>
      <description>&lt;P&gt;It's not working &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; . It just displays the events. I want to display it in the table.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 13:26:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425834#M28054</guid>
      <dc:creator>praspai</dc:creator>
      <dc:date>2018-08-24T13:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Display columns depending on sourcetype</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425835#M28055</link>
      <description>&lt;P&gt;@praspai,&lt;/P&gt;

&lt;P&gt;Can you please try the following approach?&lt;BR /&gt;
1) As your lookup contains &lt;STRONG&gt;sourcetype&lt;/STRONG&gt; and  &lt;STRONG&gt;list of fields&lt;/STRONG&gt;,  use  the &lt;STRONG&gt;sourcetype&lt;/STRONG&gt; as a  lable and  &lt;STRONG&gt;list of fields&lt;/STRONG&gt; as a value in dropdown.&lt;/P&gt;

&lt;P&gt;2) Set tokens for &lt;STRONG&gt;sourcetype&lt;/STRONG&gt; and &lt;STRONG&gt;fields&lt;/STRONG&gt; which will be used in &lt;STRONG&gt;search&lt;/STRONG&gt; query.&lt;/P&gt;

&lt;P&gt;eg:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="dropdown" token="sourcetype_tkn"&amp;gt;
  &amp;lt;label&amp;gt;SourceType&amp;lt;/label&amp;gt;
  &amp;lt;fieldForLabel&amp;gt;sourcetype&amp;lt;/fieldForLabel&amp;gt;
  &amp;lt;fieldForValue&amp;gt;Attribute&amp;lt;/fieldForValue&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;| inputlookup SourceType-Attributes | fields sourcetype Attribute&amp;lt;/query&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;change&amp;gt;
    &amp;lt;set token="Attribute"&amp;gt;$value$&amp;lt;/set&amp;gt;
    &amp;lt;set token="sourcetype"&amp;gt;$label$&amp;lt;/set&amp;gt;
  &amp;lt;/change&amp;gt;
&amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;3) Use token in your search&lt;BR /&gt;
eg.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test sourcetype="$sourcetype$" | table $Attribute$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can you please try below code?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Test1&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="sourcetype_tkn"&amp;gt;
      &amp;lt;label&amp;gt;SourceType&amp;lt;/label&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;sourcetype&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;Attribute&amp;lt;/fieldForValue&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;| inputlookup SourceType-Attributes | fields sourcetype Attribute&amp;lt;/query&amp;gt;
      &amp;lt;/search&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;set token="Attribute"&amp;gt;$value$&amp;lt;/set&amp;gt;
        &amp;lt;set token="sourcetype"&amp;gt;$label$&amp;lt;/set&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
      &amp;lt;b&amp;gt;Source Type:&amp;lt;/b&amp;gt; $sourcetype$  
      &amp;lt;b&amp;gt;Attribute :&amp;lt;/b&amp;gt;$Attribute$  

    &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;title&amp;gt;My Table&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index="_internal"  sourcetype=$sourcetype$ | table $Attribute$&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-30d@d&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My Sample Dashboard:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Test1&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="sourcetype_tkn"&amp;gt;
      &amp;lt;label&amp;gt;SourceType&amp;lt;/label&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;sourcetype&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;Attribute&amp;lt;/fieldForValue&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;| makeresults | eval sourcetype="splunkd", Attribute="component, index, source" | append [| makeresults | eval sourcetype="splunk_web_service", Attribute="log_level, component,requestid" ] | table sourcetype Attribute&amp;lt;/query&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/search&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;set token="Attribute"&amp;gt;$value$&amp;lt;/set&amp;gt;
        &amp;lt;set token="sourcetype"&amp;gt;$label$&amp;lt;/set&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
      &amp;lt;b&amp;gt;Source Type:&amp;lt;/b&amp;gt; $sourcetype$  
      &amp;lt;b&amp;gt;Fields :&amp;lt;/b&amp;gt;$Attribute$  

    &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;title&amp;gt;My Table&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index="_internal"  sourcetype=$sourcetype$ | table $Attribute$&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-30d@d&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 13:40:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425835#M28055</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-08-24T13:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Display columns depending on sourcetype</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425836#M28056</link>
      <description>&lt;P&gt;Hi @kamlesh_vaghela ,&lt;/P&gt;

&lt;P&gt;thanks for the reply.&lt;/P&gt;

&lt;P&gt;Your example works correctly. But in the case of fields from the lookup, its taking only first row to display. It's not displaying all columns mentioned in the lookup table.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 14:14:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425836#M28056</guid>
      <dc:creator>praspai</dc:creator>
      <dc:date>2018-08-24T14:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Display columns depending on sourcetype</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425837#M28057</link>
      <description>&lt;P&gt;just add the table command at the last with the fieldnames |table "field list"&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 14:32:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425837#M28057</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-08-24T14:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Display columns depending on sourcetype</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425838#M28058</link>
      <description>&lt;P&gt;@praspai,&lt;/P&gt;

&lt;P&gt;It should work.  Can you please check whether field mentioned in lookup has 100% coverage?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 17:00:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-Display-columns-depending-on-sourcetype/m-p/425838#M28058</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-08-24T17:00:37Z</dc:date>
    </item>
  </channel>
</rss>

