<?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 create table based on TRUE result? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-based-on-TRUE-result/m-p/365534#M107802</link>
    <description>&lt;P&gt;Filtering results upfront in the base search would be faster as well. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Mar 2018 16:34:26 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2018-03-20T16:34:26Z</dc:date>
    <item>
      <title>How to create table based on TRUE result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-based-on-TRUE-result/m-p/365529#M107797</link>
      <description>&lt;P&gt;I'm trying to create a query that will show me {stuff} that's happening outside of 'typical' working hours (i.e. Sat/Sun, Outside of 9 to 5 with a couple hours grace).&lt;/P&gt;

&lt;P&gt;I am using the below query to create what's essentially a boolean value (starting with day only) and I want to return a Table based on 1/True&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="&amp;lt;some_index&amp;gt;" 
| eval day_of_week=strftime(_time,"%A") 
| eval is_outside=case(day_of_week == "Saturday" OR day_of_week == "Sunday", "1",
0=0, "0") 
| where is_outside == "1"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This creates a field that looks like something I can work with. I'm just not sure how to return a table with only "1" values&lt;/P&gt;

&lt;P&gt;I've tried things along the lines of the below to no avail.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| eval test=if(day_of_week, [ table action ], "")&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 14:25:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-based-on-TRUE-result/m-p/365529#M107797</guid>
      <dc:creator>bomran</dc:creator>
      <dc:date>2018-03-20T14:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to create table based on TRUE result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-based-on-TRUE-result/m-p/365530#M107798</link>
      <description>&lt;P&gt;Nevermind, I'm having one of those days.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| where is_outside == "1"&lt;/CODE&gt; works.&lt;/P&gt;

&lt;P&gt;Happy to know if there are better ways of doing this, if not I'll post this as an answer.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 14:26:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-based-on-TRUE-result/m-p/365530#M107798</guid>
      <dc:creator>bomran</dc:creator>
      <dc:date>2018-03-20T14:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to create table based on TRUE result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-based-on-TRUE-result/m-p/365531#M107799</link>
      <description>&lt;P&gt;@bomran, you should filter the results upfront rather than getting all the data and then applying filter only for Saturday or Sunday. Try the following search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="&amp;lt;some_index&amp;gt;"  date_wday="saturday" OR date_wday="sunday" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Mar 2018 14:33:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-based-on-TRUE-result/m-p/365531#M107799</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-20T14:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create table based on TRUE result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-based-on-TRUE-result/m-p/365532#M107800</link>
      <description>&lt;P&gt;I think you could filter those right away instead of getting all events and the filter, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="&amp;lt;some_index&amp;gt;" 
    [| makeresults 
    | eval date_wday="saturday" 
    | append 
        [| makeresults 
        | eval date_wday="sunday"] 
    | return 2 date_wday]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Mar 2018 14:33:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-based-on-TRUE-result/m-p/365532#M107800</guid>
      <dc:creator>tiagofbmm</dc:creator>
      <dc:date>2018-03-20T14:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create table based on TRUE result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-based-on-TRUE-result/m-p/365533#M107801</link>
      <description>&lt;P&gt;Nice, I didn't know about date_wday. Much easier, thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 14:36:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-based-on-TRUE-result/m-p/365533#M107801</guid>
      <dc:creator>bomran</dc:creator>
      <dc:date>2018-03-20T14:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to create table based on TRUE result?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-based-on-TRUE-result/m-p/365534#M107802</link>
      <description>&lt;P&gt;Filtering results upfront in the base search would be faster as well. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 16:34:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-based-on-TRUE-result/m-p/365534#M107802</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-20T16:34:26Z</dc:date>
    </item>
  </channel>
</rss>

