<?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 Splunk Dynamic Query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Dynamic-Query/m-p/236406#M188563</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to make a dynamic query and seams not working as expected:&lt;/P&gt;

&lt;P&gt;First i load a saved search &lt;/P&gt;

&lt;P&gt;| savedsearch last7days_Table as table1&lt;/P&gt;

&lt;P&gt;The Output table:&lt;BR /&gt;&lt;BR /&gt;
clients date_wday   date_hour   got&lt;BR /&gt;
A   friday  1   1&lt;BR /&gt;
A   friday  15  1&lt;BR /&gt;
B   friday  16  1&lt;BR /&gt;
B   friday  17  1&lt;BR /&gt;
......&lt;/P&gt;

&lt;P&gt;2.nd  eval current weekday  and  current time &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Weekday=now()  
| eval Weekday =strftime(Weekday," %A")  
| eval Weekday=lower(Weekday) 
| eval timenow=now()  
| eval timenow=strftime(timenow," %H") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then a select where weekday and&lt;BR /&gt;&lt;BR /&gt;
    | where  date_wday=Weekday AND date_hour=timenow&lt;/P&gt;

&lt;P&gt;and the query do not return any data, if i do  manually  "|   where  date_wday="friday"  AND date_hour=1" &lt;BR /&gt;
it returns data.&lt;/P&gt;

&lt;P&gt;Any ideas why the query is not returning the expected data ?  &lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 10:05:26 GMT</pubDate>
    <dc:creator>ffr03</dc:creator>
    <dc:date>2020-09-29T10:05:26Z</dc:date>
    <item>
      <title>Splunk Dynamic Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Dynamic-Query/m-p/236406#M188563</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to make a dynamic query and seams not working as expected:&lt;/P&gt;

&lt;P&gt;First i load a saved search &lt;/P&gt;

&lt;P&gt;| savedsearch last7days_Table as table1&lt;/P&gt;

&lt;P&gt;The Output table:&lt;BR /&gt;&lt;BR /&gt;
clients date_wday   date_hour   got&lt;BR /&gt;
A   friday  1   1&lt;BR /&gt;
A   friday  15  1&lt;BR /&gt;
B   friday  16  1&lt;BR /&gt;
B   friday  17  1&lt;BR /&gt;
......&lt;/P&gt;

&lt;P&gt;2.nd  eval current weekday  and  current time &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Weekday=now()  
| eval Weekday =strftime(Weekday," %A")  
| eval Weekday=lower(Weekday) 
| eval timenow=now()  
| eval timenow=strftime(timenow," %H") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then a select where weekday and&lt;BR /&gt;&lt;BR /&gt;
    | where  date_wday=Weekday AND date_hour=timenow&lt;/P&gt;

&lt;P&gt;and the query do not return any data, if i do  manually  "|   where  date_wday="friday"  AND date_hour=1" &lt;BR /&gt;
it returns data.&lt;/P&gt;

&lt;P&gt;Any ideas why the query is not returning the expected data ?  &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:05:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Dynamic-Query/m-p/236406#M188563</guid>
      <dc:creator>ffr03</dc:creator>
      <dc:date>2020-09-29T10:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Dynamic Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Dynamic-Query/m-p/236407#M188564</link>
      <description>&lt;P&gt;My guess is that there are blank spaces in timenow and Weekday.&lt;BR /&gt;
This using trim:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Weekday =trim(lower(strftime(now()," %A")))  
| eval timenow=trim(strftime(now()," %H"))
| where date_wday=Weekday AND timenow=date_hour
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Jul 2016 11:43:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Dynamic-Query/m-p/236407#M188564</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-07-01T11:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Dynamic Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Dynamic-Query/m-p/236408#M188565</link>
      <description>&lt;P&gt;Alternatively remove the space from the strftime formats&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval Weekday=now()  
 | eval Weekday =strftime(Weekday,"%A")  
 | eval Weekday=lower(Weekday) 
 | eval timenow=now()  
 | eval timenow=strftime(timenow,"%H") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Dave&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 11:48:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Dynamic-Query/m-p/236408#M188565</guid>
      <dc:creator>davebrooking</dc:creator>
      <dc:date>2016-07-01T11:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Dynamic Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Dynamic-Query/m-p/236409#M188566</link>
      <description>&lt;P&gt;Good point, didn't even notice that&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 11:49:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Dynamic-Query/m-p/236409#M188566</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-07-01T11:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Dynamic Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Dynamic-Query/m-p/236410#M188567</link>
      <description>&lt;P&gt;thx bouth &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; working &lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 12:53:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Dynamic-Query/m-p/236410#M188567</guid>
      <dc:creator>ffr03</dc:creator>
      <dc:date>2016-07-01T12:53:09Z</dc:date>
    </item>
  </channel>
</rss>

