<?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 pass hostname to scripted input in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/pass-hostname-to-scripted-input/m-p/46504#M8781</link>
    <description>&lt;P&gt;Hi, I want to create a scripted input, a script that will query sql server on a machine.  I want the query to be executed on whatever host I set up the input for, so I assume I should pass the hostname as an argument to the script.  How can I do that dynamically? is there a variable in splunk that can expand automatically? So I could set splunk up to run the script something like this:&lt;/P&gt;

&lt;P&gt;script.cmd $hostname&lt;/P&gt;</description>
    <pubDate>Fri, 18 Feb 2011 01:55:02 GMT</pubDate>
    <dc:creator>jgeyer14</dc:creator>
    <dc:date>2011-02-18T01:55:02Z</dc:date>
    <item>
      <title>pass hostname to scripted input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/pass-hostname-to-scripted-input/m-p/46504#M8781</link>
      <description>&lt;P&gt;Hi, I want to create a scripted input, a script that will query sql server on a machine.  I want the query to be executed on whatever host I set up the input for, so I assume I should pass the hostname as an argument to the script.  How can I do that dynamically? is there a variable in splunk that can expand automatically? So I could set splunk up to run the script something like this:&lt;/P&gt;

&lt;P&gt;script.cmd $hostname&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2011 01:55:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/pass-hostname-to-scripted-input/m-p/46504#M8781</guid>
      <dc:creator>jgeyer14</dc:creator>
      <dc:date>2011-02-18T01:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: pass hostname to scripted input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/pass-hostname-to-scripted-input/m-p/46505#M8782</link>
      <description>&lt;P&gt;nevermind i figured it out.  right now I am adding a new scripted input for each host and passing it manually like so:&lt;/P&gt;

&lt;H1&gt;first arg is the hostname the script will use to do the query&lt;/H1&gt;

&lt;PRE&gt;
[script://$SPLUNK_HOME\bin\scripts\test.cmd testhost]
interval = 5
sourcetype = sql:test        
source = jamiesqltest
host=testhost
disabled=0


[script://$SPLUNK_HOME\bin\scripts\test.cmd testhost-2]
interval = 5
sourcetype = sql:test        
source = jamiesqltest
host=testhost-2
disabled=0
&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Feb 2011 03:09:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/pass-hostname-to-scripted-input/m-p/46505#M8782</guid>
      <dc:creator>jgeyer14</dc:creator>
      <dc:date>2011-02-18T03:09:32Z</dc:date>
    </item>
  </channel>
</rss>

