<?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: Iterate through dbxquery (SQL) results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Iterate-through-dbxquery-SQL-results/m-p/609985#M212113</link>
    <description>&lt;P&gt;Thanks for taking the time to respond&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp; !&lt;BR /&gt;&lt;BR /&gt;Great, and if I wanted to take that col1 value and say, include it in an evaluated field called description, how would I compile that?&lt;BR /&gt;&lt;BR /&gt;e.g. below just produces col1 as plain text, rather than the actual value from the query&lt;BR /&gt;&lt;BR /&gt;| eval Description="col1"." - "."This alert monitors Juice"&lt;/P&gt;</description>
    <pubDate>Thu, 18 Aug 2022 13:50:42 GMT</pubDate>
    <dc:creator>lukenorthern</dc:creator>
    <dc:date>2022-08-18T13:50:42Z</dc:date>
    <item>
      <title>Iterate through dbxquery (SQL) results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Iterate-through-dbxquery-SQL-results/m-p/609977#M212107</link>
      <description>&lt;P&gt;Hello&lt;BR /&gt;&lt;BR /&gt;I have a search which is gathering 8 columns from a table. (below)&lt;BR /&gt;&lt;BR /&gt;I want to make col1 available to query against later in the SPL. I tried to access via "rename query.col1 as col1" for example but the data does not seem to appear, almost as if query.col1 is not valid? Can't find any info on how to remedy this elsewhere on the site, apologies if this has been asked before. The query returns 1 row.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;| dbxquery query="Select col1,col2,col3,col4,col5,col6,col7,col8 from JuiceTable
where col1 = 'special value'" connection="Juice-Prod"
| stats count as total
| eval Status=case(total=0,"Healthy",total &amp;gt; 0, "Critical")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 14:07:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Iterate-through-dbxquery-SQL-results/m-p/609977#M212107</guid>
      <dc:creator>lukenorthern</dc:creator>
      <dc:date>2022-08-18T14:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through dbxquery (SQL) results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Iterate-through-dbxquery-SQL-results/m-p/609983#M212111</link>
      <description>&lt;P&gt;The stats command will reduce the event pipeline to a single event with one field (total). If you want more fields, you will have to modify the stats command&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count as total by col1&lt;/LI-CODE&gt;&lt;P&gt;However, this will give you an event (row) for each value of col1, not the total number of events.&lt;/P&gt;&lt;P&gt;Alternatively, you could filter the events before the stats command&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where col1="some value"
| stats count as total&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 18 Aug 2022 13:43:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Iterate-through-dbxquery-SQL-results/m-p/609983#M212111</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-08-18T13:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through dbxquery (SQL) results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Iterate-through-dbxquery-SQL-results/m-p/609985#M212113</link>
      <description>&lt;P&gt;Thanks for taking the time to respond&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp; !&lt;BR /&gt;&lt;BR /&gt;Great, and if I wanted to take that col1 value and say, include it in an evaluated field called description, how would I compile that?&lt;BR /&gt;&lt;BR /&gt;e.g. below just produces col1 as plain text, rather than the actual value from the query&lt;BR /&gt;&lt;BR /&gt;| eval Description="col1"." - "."This alert monitors Juice"&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 13:50:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Iterate-through-dbxquery-SQL-results/m-p/609985#M212113</guid>
      <dc:creator>lukenorthern</dc:creator>
      <dc:date>2022-08-18T13:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through dbxquery (SQL) results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Iterate-through-dbxquery-SQL-results/m-p/609986#M212114</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval Description=col1." - This alert monitors Juice"&lt;/LI-CODE&gt;&lt;P&gt;If you real col1 contains special characters, then wrap it in single (not double) quotes&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Description='col1'." - This alert monitors Juice"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 18 Aug 2022 13:53:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Iterate-through-dbxquery-SQL-results/m-p/609986#M212114</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-08-18T13:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through dbxquery (SQL) results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Iterate-through-dbxquery-SQL-results/m-p/609987#M212115</link>
      <description>&lt;P&gt;The field names are the same as the column names.&amp;nbsp; No rename is needed.&amp;nbsp; In this example, it's just "col1".&lt;/P&gt;&lt;P&gt;"query" is the name of an argument to the &lt;FONT face="courier new,courier"&gt;dbxquery&lt;/FONT&gt; command.&amp;nbsp; It's not an object.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 13:54:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Iterate-through-dbxquery-SQL-results/m-p/609987#M212115</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-08-18T13:54:24Z</dc:date>
    </item>
  </channel>
</rss>

