<?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 fill text box and write to external file through dashboard form input in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-fill-text-box-and-write-to-external-file-through/m-p/126326#M7438</link>
    <description>&lt;P&gt;Under the statment xml fieldset declaration, you have to insert the search via your phyton script :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
   &amp;lt;label&amp;gt;Input Form&amp;lt;/label&amp;gt;
   &amp;lt;fieldset submitButton="true" autoRun="false"&amp;gt;
     &amp;lt;input type="text" token="input1"&amp;gt;
       &amp;lt;label&amp;gt;INPUT 1&amp;lt;/label&amp;gt;
     &amp;lt;/input&amp;gt;
   &amp;lt;input type="text" token="input2"&amp;gt;
       &amp;lt;label&amp;gt;INPUT2&amp;lt;/label&amp;gt;
   &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
\&amp;lt;/form&amp;gt;
#####   HERE INSERT THE SEARCH VIA PYTHON SCRIPT
&amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;|  input  "$input1$" "$input2$"&amp;lt;/query&amp;gt;  
    &amp;lt;earliest&amp;gt;&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;&amp;lt;/latest&amp;gt;
&amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Antonio&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jan 2016 11:00:44 GMT</pubDate>
    <dc:creator>aagro</dc:creator>
    <dc:date>2016-01-15T11:00:44Z</dc:date>
    <item>
      <title>How to fill text box and write to external file through dashboard form input</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-fill-text-box-and-write-to-external-file-through/m-p/126324#M7436</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;
i need to give possibility to users to fill two text box and then write the value in one external lookup file put in the lookup directory&lt;BR /&gt;
The form dashboard is quite simply: [TEXT-BOX1]   [TEXT-BOX2]   SubmitButton&lt;/P&gt;

&lt;P&gt;I read this post:&lt;BR /&gt;
&lt;A href="http://answers.splunk.com/answers/64502/i-want-to-modify-lookup-file-directly-through-the-dashboard.html"&gt;http://answers.splunk.com/answers/64502/i-want-to-modify-lookup-file-directly-through-the-dashboard.html&lt;/A&gt;&lt;BR /&gt;
but i'm not familiar with python so that is what i do:&lt;/P&gt;

&lt;P&gt;1) I create a simple script called &lt;STRONG&gt;input.py&lt;/STRONG&gt; and put in &lt;STRONG&gt;bin/&lt;/STRONG&gt; directory:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;input1 = input(test1)
input2 = input(test2)
#file = open("/opt/splunk/etc/apps/&amp;lt;myApp&amp;gt;/lookups/testinput.csv", "w")
file.write(input1 + "," + input2 + "\n") #still the \n for separating lines in the file
file.write("\n".join((input1,input2,)))
file.close()
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) I create a &lt;STRONG&gt;commands.conf&lt;/STRONG&gt; and put in &lt;STRONG&gt;local/&lt;/STRONG&gt; directory&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [input]
 filename = /opt/splunk/etc/apps/&amp;lt;myApp&amp;gt;/bin/input.py
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now the questions are:&lt;BR /&gt;
1) Is correct the script as i wrote? (if not, please can indicate me how i write the correct code)&lt;BR /&gt;
2) How i can recall the stanza in my dashboard form?&lt;BR /&gt;
The code of the dashboard is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Input Form&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="true" autoRun="false"&amp;gt;
    &amp;lt;input type="text" token="input1"&amp;gt;
      &amp;lt;label&amp;gt;INPUT 1&amp;lt;/label&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="text" token="input2"&amp;gt;
      &amp;lt;label&amp;gt;INPUT2&amp;lt;/label&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you for your support&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2014 10:19:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-fill-text-box-and-write-to-external-file-through/m-p/126324#M7436</guid>
      <dc:creator>lies2yk</dc:creator>
      <dc:date>2014-09-16T10:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill text box and write to external file through dashboard form input</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-fill-text-box-and-write-to-external-file-through/m-p/126325#M7437</link>
      <description>&lt;P&gt;Have you considered using a combination of the &lt;CODE&gt;inputlookup&lt;/CODE&gt; and &lt;CODE&gt;outputlookup&lt;/CODE&gt; search commands?&lt;/P&gt;

&lt;P&gt;Here's a detailed example: &lt;A href="http://blogs.splunk.com/2011/01/11/maintaining-state-of-the-union/"&gt;http://blogs.splunk.com/2011/01/11/maintaining-state-of-the-union/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Additionally, if you're just looking for a way to edit lookups through the UI, take a look at Luke's Lookup File Editor app at &lt;A href="http://apps.splunk.com/app/1724/"&gt;http://apps.splunk.com/app/1724/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2014 10:41:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-fill-text-box-and-write-to-external-file-through/m-p/126325#M7437</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-09-16T10:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill text box and write to external file through dashboard form input</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-fill-text-box-and-write-to-external-file-through/m-p/126326#M7438</link>
      <description>&lt;P&gt;Under the statment xml fieldset declaration, you have to insert the search via your phyton script :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
   &amp;lt;label&amp;gt;Input Form&amp;lt;/label&amp;gt;
   &amp;lt;fieldset submitButton="true" autoRun="false"&amp;gt;
     &amp;lt;input type="text" token="input1"&amp;gt;
       &amp;lt;label&amp;gt;INPUT 1&amp;lt;/label&amp;gt;
     &amp;lt;/input&amp;gt;
   &amp;lt;input type="text" token="input2"&amp;gt;
       &amp;lt;label&amp;gt;INPUT2&amp;lt;/label&amp;gt;
   &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
\&amp;lt;/form&amp;gt;
#####   HERE INSERT THE SEARCH VIA PYTHON SCRIPT
&amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;|  input  "$input1$" "$input2$"&amp;lt;/query&amp;gt;  
    &amp;lt;earliest&amp;gt;&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;&amp;lt;/latest&amp;gt;
&amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Antonio&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2016 11:00:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-fill-text-box-and-write-to-external-file-through/m-p/126326#M7438</guid>
      <dc:creator>aagro</dc:creator>
      <dc:date>2016-01-15T11:00:44Z</dc:date>
    </item>
  </channel>
</rss>

