<?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: Splunk DB Connect 1: Can I run dbquery with a variable? in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/Splunk-DB-Connect-1-Can-I-run-dbquery-with-a-variable/m-p/225884#M10698</link>
    <description>&lt;P&gt;Worked a treat.  Thanks.  I can't figure out what gentimes is used for though.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Mar 2016 11:46:27 GMT</pubDate>
    <dc:creator>stepheneardley</dc:creator>
    <dc:date>2016-03-02T11:46:27Z</dc:date>
    <item>
      <title>Splunk DB Connect 1: Can I run dbquery with a variable?</title>
      <link>https://community.splunk.com/t5/Reporting/Splunk-DB-Connect-1-Can-I-run-dbquery-with-a-variable/m-p/225882#M10696</link>
      <description>&lt;P&gt;I need to schedule a report which runs dbquery, but I need that report to run with a variable in the query e.g.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval myVar=stuff
| dbquery source "select * from table where timestamp &amp;gt;= '".myVar."'"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or something like that, but of course this doesn't work since dbquery must be the first command of a search.&lt;/P&gt;

&lt;P&gt;Has anyone come across this before or found a way around it?  &lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2016 21:13:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Splunk-DB-Connect-1-Can-I-run-dbquery-with-a-variable/m-p/225882#M10696</guid>
      <dc:creator>stepheneardley</dc:creator>
      <dc:date>2016-03-01T21:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect 1: Can I run dbquery with a variable?</title>
      <link>https://community.splunk.com/t5/Reporting/Splunk-DB-Connect-1-Can-I-run-dbquery-with-a-variable/m-p/225883#M10697</link>
      <description>&lt;P&gt;You can try like this (using map command)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval myVar=stuff | map search="| dbquery source \"select * from tble where timestamp &amp;gt;= $myVar$ \" "
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Mar 2016 22:38:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Splunk-DB-Connect-1-Can-I-run-dbquery-with-a-variable/m-p/225883#M10697</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-03-01T22:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect 1: Can I run dbquery with a variable?</title>
      <link>https://community.splunk.com/t5/Reporting/Splunk-DB-Connect-1-Can-I-run-dbquery-with-a-variable/m-p/225884#M10698</link>
      <description>&lt;P&gt;Worked a treat.  Thanks.  I can't figure out what gentimes is used for though.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 11:46:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Splunk-DB-Connect-1-Can-I-run-dbquery-with-a-variable/m-p/225884#M10698</guid>
      <dc:creator>stepheneardley</dc:creator>
      <dc:date>2016-03-02T11:46:27Z</dc:date>
    </item>
  </channel>
</rss>

