<?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 query to exclude the searched strings based on date and display in table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480869#M140440</link>
    <description>&lt;P&gt;Sample query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=1000
| eval Filenames=trim("string_1L_2".(random() % 4),"0")
| streamstats count
| stats count by Filenames
| append [ | makeresults
| eval counter=mvappend("0",mvrange(1,4),"5")
| mvexpand counter
| eval Filenames=trim("string_1L_2".counter,"0")
| table Filenames]
| stats dc(count) as FileExists by Filenames
| eval FileExists=case(FileExists=1,"yes",FileExists=0,"no")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Recommend:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=123 host=htrstef87 "string_1," "created" NOT client_ip="192.168.17.5" "String_examp_*" "xml.7z.pgp" 
| eval keyword=case(searchmatch("string_1L_2"),"string_1L_2",searchmatch("string_1L_21")
    ,"string_1L_21",searchmatch("string_1L_22"),"string_1L_22",searchmatch("string_1L_23")
    ,"string_1L_23",searchmatch("string_1L_24"),"string_1L_24") 
| eval DateReport=strftime(_time, "%Y-%m") 
| eval Filename=coalesce(FileName,keyword) 
| stats count by DateReport Filename 
| append 
    [| makeresults 
    | eval counter=mvrange(0,5) 
    | mvexpand counter 
    | eval Filename=trim("string_1L_2".counter,"0") 
    | table Filename] 
| stats dc(count) as FileExists by Filename 
| eval FileExists=case(FileExists=1,"yes",FileExists=0,"no")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not sure your original field name. if there is a few typo, please amend it.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Mar 2020 07:25:56 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-03-05T07:25:56Z</dc:date>
    <item>
      <title>Splunk query to exclude the searched strings based on date and display in table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480866#M140437</link>
      <description>&lt;P&gt;Hi Splukers,&lt;/P&gt;

&lt;P&gt;I have a requirement to search for some filenames and display the missing files as per the date. Thus, i made up a query to look like&lt;/P&gt;

&lt;P&gt;index=123 host=htrstef87 "string_1," "created" NOT client_ip="192.168.17.5" "String_examp_*" "xml.7z.pgp" | eval keyword=case(searchmatch("string_1L_2"),"string_1L_2",searchmatch("string_1L_21"),"string_1L_21",searchmatch("string_1L_22"),"string_1L_22",searchmatch("string_1L_23"),"string_1L_23",searchmatch("string_1L_24"),"string_1L_24")  | eval Filestatus=if(like(keyword, "string_1L%"), "fileFound", "Filenotfound") |eval DateReport= date_month."-".date_year| stats values(keyword), values(FileName), values(Filesize) by DateReport | where Filesize&amp;gt;0&lt;/P&gt;

&lt;P&gt;This displays all the filenames with all the data. But the requirement is to match the keyword and check them every month at certain date and send them if any files are missing or no bytes (filesize).&lt;/P&gt;

&lt;P&gt;Any help is much appreciated.&lt;/P&gt;

&lt;P&gt;note: I am running splunk 6.5.3 and thus queries like where(in) does not work for me.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Amit&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:22:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480866#M140437</guid>
      <dc:creator>asharmaeqfx</dc:creator>
      <dc:date>2020-09-30T04:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query to exclude the searched strings based on date and display in table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480867#M140438</link>
      <description>&lt;P&gt;Write a saved search that executes on a cron schedule ?&lt;BR /&gt;
The result can then be displayed based on requirement (dashboard panel / email etc.)&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 23:39:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480867#M140438</guid>
      <dc:creator>anmolpatel</dc:creator>
      <dc:date>2020-03-02T23:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query to exclude the searched strings based on date and display in table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480868#M140439</link>
      <description>&lt;P&gt;yes but i still does not show me missing files. Rather all the files which came fine.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 02:49:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480868#M140439</guid>
      <dc:creator>asharmaeqfx</dc:creator>
      <dc:date>2020-03-04T02:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query to exclude the searched strings based on date and display in table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480869#M140440</link>
      <description>&lt;P&gt;Sample query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=1000
| eval Filenames=trim("string_1L_2".(random() % 4),"0")
| streamstats count
| stats count by Filenames
| append [ | makeresults
| eval counter=mvappend("0",mvrange(1,4),"5")
| mvexpand counter
| eval Filenames=trim("string_1L_2".counter,"0")
| table Filenames]
| stats dc(count) as FileExists by Filenames
| eval FileExists=case(FileExists=1,"yes",FileExists=0,"no")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Recommend:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=123 host=htrstef87 "string_1," "created" NOT client_ip="192.168.17.5" "String_examp_*" "xml.7z.pgp" 
| eval keyword=case(searchmatch("string_1L_2"),"string_1L_2",searchmatch("string_1L_21")
    ,"string_1L_21",searchmatch("string_1L_22"),"string_1L_22",searchmatch("string_1L_23")
    ,"string_1L_23",searchmatch("string_1L_24"),"string_1L_24") 
| eval DateReport=strftime(_time, "%Y-%m") 
| eval Filename=coalesce(FileName,keyword) 
| stats count by DateReport Filename 
| append 
    [| makeresults 
    | eval counter=mvrange(0,5) 
    | mvexpand counter 
    | eval Filename=trim("string_1L_2".counter,"0") 
    | table Filename] 
| stats dc(count) as FileExists by Filename 
| eval FileExists=case(FileExists=1,"yes",FileExists=0,"no")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not sure your original field name. if there is a few typo, please amend it.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 07:25:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480869#M140440</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-05T07:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query to exclude the searched strings based on date and display in table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480870#M140441</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=123 host=htrstef87 "string_1," "created" NOT client_ip="192.168.17.5" "String_examp_*" "xml.7z.pgp" 
| eval DateReport= strftime(_time, "%Y-%m") 
| stats count(eval(isnull(FileName))) as missing_File_count count(eval(searchmatch("string_1L"))) as File_count by DateReport
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Mar 2020 07:25:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480870#M140441</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-05T07:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query to exclude the searched strings based on date and display in table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480871#M140442</link>
      <description>&lt;P&gt;This works and displays the same result. But my requirement is there are five strings and i need see from the query and check if they are missing. Currently i need the keywords in a column and one more column shows whether it exists or not&lt;/P&gt;

&lt;P&gt;Keywords/Filenames   FileExists&lt;BR /&gt;
string_1L_2                    Yes&lt;BR /&gt;
string_1L_21                   No&lt;BR /&gt;
string_1L_22                   Yes&lt;BR /&gt;
string_1L_23                   No&lt;BR /&gt;
string_1L_25                   Yes&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:29:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480871#M140442</guid>
      <dc:creator>asharmaeqfx</dc:creator>
      <dc:date>2020-09-30T04:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query to exclude the searched strings based on date and display in table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480872#M140443</link>
      <description>&lt;P&gt;I've taken @to4kawa 's initial query and made modification to what you're looking for&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=10000 
| eval COMMENT= "Randomly generate file names with the below string names"
| eval File="string_1L_".(random() % 8)
| eval File="string_L_".(random() % 8)

| eval COMMENT= "For filename with string_1L_2 create file in series from 20-28"
| append 
    [| makeresults 
    | eval counter=mvappend("0",mvrange(1,8),"8") 
    | mvexpand counter 
    | eval File=trim("string_1L_2".counter,"1") 
    | table File] 
| stats count by File

| eval COMMENT = " Have replaced searchmatch function with match function using regex to check if you've a file with the particular string. This avoids multiple checks. You can replace the regex .*string_1L_2.* with .*string_1L_ .* and this will match with all values that get generated above, to test further."
| eval FileExists=if(match(File, ".*string_1L_2.*"),"Yes", "No")
| table File FileExists
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The eval I've above for File Exists, effectively replaces what you're doing here:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval keyword=case(searchmatch("string_1L_2"),"string_1L_2",searchmatch("string_1L_21"),"string_1L_21",searchmatch("string_1L_22"),"string_1L_22",searchmatch("string_1L_23"),"string_1L_23",searchmatch("string_1L_24"),"string_1L_24") 
| eval Filestatus=if(like(keyword, "string_1L%"), "fileFound", "Filenotfound")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can add in your Filesize check after that.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 23:51:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-query-to-exclude-the-searched-strings-based-on-date-and/m-p/480872#M140443</guid>
      <dc:creator>anmolpatel</dc:creator>
      <dc:date>2020-03-05T23:51:50Z</dc:date>
    </item>
  </channel>
</rss>

