<?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: If/Else Conditions in a form base on Dropdown Selection in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165998#M47232</link>
    <description>&lt;P&gt;it doesn't return any data for me. the fields for proxysg are client_ip and dest_ip instead of src_ip and dst_ip.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 16:38:32 GMT</pubDate>
    <dc:creator>jaywilwk</dc:creator>
    <dc:date>2020-09-28T16:38:32Z</dc:date>
    <item>
      <title>If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165979#M47213</link>
      <description>&lt;P&gt;I've created a form that has a dropdown where users can select their sourcetype. Within each sourcetype, the fields are different. Is there a way for me to have the associated fields available based on the sourcetype that the user selects? If so how do I do this? Below is my form.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
&amp;lt;label&amp;gt;Threat Dashboard&amp;lt;/label&amp;gt;
   &amp;lt;fieldset autoRun="false" submitButton="true"&amp;gt;
      &amp;lt;input type="text" token="src_ip"&amp;gt;
      &amp;lt;label&amp;gt;Source IP:&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
      &amp;lt;input type="text" token="src_port"&amp;gt;
      &amp;lt;label&amp;gt;Source Port:&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="text" token="dst_ip"&amp;gt;
      &amp;lt;label&amp;gt;Destination IP:&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="text" token="dst_port"&amp;gt;
      &amp;lt;label&amp;gt;Destination Port:&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="dropdown" token="sourcetype"&amp;gt;
      &amp;lt;label&amp;gt;Select Sourcetype:&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;pan_traffic&amp;lt;/default&amp;gt;
      &amp;lt;populatingSearch fieldForValue="sourcetype" fieldForLabel="sourcetype" earliest="-120m" latest="-90m"&amp;gt;
        &amp;lt;![CDATA[index=* | stats count by sourcetype]]&amp;gt;
      &amp;lt;/populatingSearch&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="time" searchWhenChanged="false"&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliestTime&amp;gt;-15m&amp;lt;/earliestTime&amp;gt;
        &amp;lt;latestTime&amp;gt;now&amp;lt;/latestTime&amp;gt;
      &amp;lt;/default&amp;gt;
       &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
    &amp;lt;row&amp;gt;
    &amp;lt;table&amp;gt;
      &amp;lt;title&amp;gt;Investigate Source IP: $src_ip$&amp;lt;/title&amp;gt;
      &amp;lt;searchString&amp;gt;sourcetype=$sourcetype$ src_ip=$src_ip$ dst_ip=$dst_ip$ src_port=$src_port$ dst_port=$dst_port$ | table src_ip, dst_ip, action, src_port, dst_port&amp;lt;/searchString&amp;gt;

    &amp;lt;/table&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 May 2014 14:15:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165979#M47213</guid>
      <dc:creator>jaywilwk</dc:creator>
      <dc:date>2014-05-15T14:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165980#M47214</link>
      <description>&lt;P&gt;Are you saying you want to customize filters used in search and fields displayed in table based on sourcetype selected?&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 15:07:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165980#M47214</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-15T15:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165981#M47215</link>
      <description>&lt;P&gt;ok let's say the fields src_ip and dst_ip is only available when the user select proxysg as their sourcetype. let's say I want client_ip and dest_ip available in my search result when the user select sourcetype=pan_traffic in the drop down. So based on the sourcetype selected, I want those field available that are associated with the sourcetype.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:37:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165981#M47215</guid>
      <dc:creator>jaywilwk</dc:creator>
      <dc:date>2020-09-28T16:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165982#M47216</link>
      <description>&lt;P&gt;Try this in you searchString for the table.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  sourcetype=$sourcetype$ src_ip=$src_ip$ dst_ip=$dst_ip$ src_port=$src_port$ dst_port=$dst_port$ | table [|stats count| eval search=case("$sourcetype$"="proxysg","src_ip, dst_ip, action","$sourcetype$"="pan_traffic","action, src_port, dst_port", 1=1,"src_ip, dst_ip, action, src_port, dst_port")  | table search]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Update:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=$sourcetype$  [|stats count | eval src_ip="$src_ip$" | eval dst_ip="$dst_ip$" 
| eval src_port="$src_port$" | eval dst_port="$dst_port$" | eval client_ip="$src_ip$" 
| eval dest_ip="$dst_ip$" | eval port=split("$src_port$,$dst_port$",",") | mvexpand port
| eval host=port
| table [|stats count| eval search=case(
"$sourcetype$"="proxysg","client_ip,dest_ip,port",
"$sourcetype$"="pan_traffic" OR "$sourcetype$"="pan_threat","src_ip, dst_ip,src_port,dst_port", 
"$sourcetype$"="ciscoios", "host" ,
1=1,"")  | table search] | format]
| table [|stats count| eval search=case(
"$sourcetype$"="proxysg","client_ip, dest_ip, action,port",
"$sourcetype$"="pan_traffic" OR "$sourcetype$"="pan_threat","src_ip,dst_ip,action,src_port,dst_port", 
"$sourcetype$"="ciscoios", "host,action,syslog_message" ,
1=1,"*")  | table search]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 May 2014 16:09:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165982#M47216</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-15T16:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165983#M47217</link>
      <description>&lt;P&gt;You want something similar to this, I believe:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://answers.splunk.com/answers/11783/building-a-view-with-2-dynamic-drop-down-menus"&gt;Possible Solution&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 16:24:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165983#M47217</guid>
      <dc:creator>Lazarix</dc:creator>
      <dc:date>2014-05-15T16:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165984#M47218</link>
      <description>&lt;P&gt;I tried this and I got an error in my eval command: The expression is malformed. Expected ).&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 16:44:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165984#M47218</guid>
      <dc:creator>jaywilwk</dc:creator>
      <dc:date>2014-05-15T16:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165985#M47219</link>
      <description>&lt;P&gt;My bad, missed one bracket. Updated the answer. Try now.&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 17:50:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165985#M47219</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-15T17:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165986#M47220</link>
      <description>&lt;P&gt;I tried it and I didn't get anything back for the proxysg sourcetype.&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 18:08:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165986#M47220</guid>
      <dc:creator>jaywilwk</dc:creator>
      <dc:date>2014-05-15T18:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165987#M47221</link>
      <description>&lt;P&gt;The filters in the base search also needs to be filtered based on sourcetype. Try the updated answer.&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 18:19:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165987#M47221</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-15T18:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165988#M47222</link>
      <description>&lt;P&gt;it seems like it's on the right track, but I'm still not getting results. I have the default sourcetype=pan_traffic in the dropdown and the fields are src_ip, dst_ip, src_port, dst_port. In proxysg, fields are client_ip, dest_ip, port.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:37:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165988#M47222</guid>
      <dc:creator>jaywilwk</dc:creator>
      <dc:date>2020-09-28T16:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165989#M47223</link>
      <description>&lt;P&gt;This was the critical information missing from the question. Can you confirm the final list of sourcetype-field list and mapping to dropdown in the form.&lt;/P&gt;

&lt;P&gt;sourcetype=pan_traffic&lt;/P&gt;

&lt;H2&gt;field       dropdown&lt;/H2&gt;

&lt;P&gt;src_ip      src_ip&lt;BR /&gt;
dst_ip      dst_ip&lt;BR /&gt;
src_port    src_port&lt;BR /&gt;
dst_port    dst_port&lt;/P&gt;

&lt;P&gt;sourcetype=proxysg&lt;/P&gt;

&lt;H2&gt;field       dropdown&lt;/H2&gt;

&lt;P&gt;client_ip   src_ip&lt;BR /&gt;
dest_ip     dst_ip&lt;BR /&gt;
port        src_port OR  dst_port????&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:37:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165989#M47223</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-28T16:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165990#M47224</link>
      <description>&lt;P&gt;in the proxysg, there is only port, which would be for the src_port and dst_port&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:38:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165990#M47224</guid>
      <dc:creator>jaywilwk</dc:creator>
      <dc:date>2020-09-28T16:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165991#M47225</link>
      <description>&lt;P&gt;What should be the query if you want to search proxysg logs with dropdown values? Will it be this?&lt;/P&gt;

&lt;P&gt;sourcetype=proxy client_ip=$src_ip$ dest_ip=$dst_ip$ port=$src_ip$ OR port=$dst_ip$&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:38:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165991#M47225</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-28T16:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165992#M47226</link>
      <description>&lt;P&gt;yes that's right.&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 20:21:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165992#M47226</guid>
      <dc:creator>jaywilwk</dc:creator>
      <dc:date>2014-05-15T20:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165993#M47227</link>
      <description>&lt;P&gt;Try updated answer now.&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 20:42:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165993#M47227</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-15T20:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165994#M47228</link>
      <description>&lt;P&gt;I tried the update and I didn't get any results when proxysg was the sourcetype.&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 13:35:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165994#M47228</guid>
      <dc:creator>jaywilwk</dc:creator>
      <dc:date>2014-05-16T13:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165995#M47229</link>
      <description>&lt;P&gt;Does this returns records with both sourcetype is selected.&lt;/P&gt;

&lt;P&gt;sourcetype=$sourcetype$  [|stats count | eval src_ip="$src_ip$" | eval dst_ip="$dst_ip$" &lt;BR /&gt;
    | eval src_port="$src_port$" | eval dst_port="$dst_port$" | eval port=split("$src_port$,$dst_port$",",") | mvexpand port&lt;BR /&gt;
    | table [|stats count| eval search=case(&lt;BR /&gt;
    "$sourcetype$"="proxysg","src_ip,dst_ip,port",&lt;BR /&gt;
    "$sourcetype$"="pan_traffic","src_ip, dst_ip,src_port,dst_port", &lt;BR /&gt;
    1=1,"")  | table search] | format]&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:38:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165995#M47229</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-28T16:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165996#M47230</link>
      <description>&lt;P&gt;I get results back when I select pan_traffic as my sourcetype but nothing back when I select proxysg as my sourcetype from the dropdown.&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 14:10:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165996#M47230</guid>
      <dc:creator>jaywilwk</dc:creator>
      <dc:date>2014-05-16T14:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165997#M47231</link>
      <description>&lt;P&gt;I created the same dashboard (with my query) and the final query being executed (I can see results as I don't have the data) is below (for sourcetype selected as proxysg and all default dropdown values):-&lt;/P&gt;

&lt;P&gt;sourcetype=proxysg  ( ( dst_ip="*" AND port="*" AND src_ip="*" ) OR ( dst_ip="*" AND port="*" AND src_ip="*" ) )&lt;BR /&gt;
 | table  src_ip, dst_ip, action,port&lt;/P&gt;

&lt;P&gt;can you validate if this query returns data for you?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:38:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165997#M47231</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-28T16:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: If/Else Conditions in a form base on Dropdown Selection</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165998#M47232</link>
      <description>&lt;P&gt;it doesn't return any data for me. the fields for proxysg are client_ip and dest_ip instead of src_ip and dst_ip.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:38:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Else-Conditions-in-a-form-base-on-Dropdown-Selection/m-p/165998#M47232</guid>
      <dc:creator>jaywilwk</dc:creator>
      <dc:date>2020-09-28T16:38:32Z</dc:date>
    </item>
  </channel>
</rss>

