<?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 alert based on condition match in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676665#M231406</link>
    <description>&lt;P&gt;Great.&amp;nbsp; Those two searches should be able to be easily combined into one.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, I've thought about this and I'm not sure I have quite enough information yet because I feel there's a *lot* still left unsaid.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it would be great if you could describe the use case in a little more detail just using words and English, ignoring how you think the Splunk solution will be formulated.&lt;/P&gt;&lt;P&gt;I'm guessing something like - "whenever a new gz file is created, we need to check if that file was also processed or not and send an email with that information as an alert."&amp;nbsp; That leaves as open questions&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;how long is the time period involved&lt;/LI&gt;&lt;LI&gt;how often will you have this alert scheduled for (different from the first question!)&lt;/LI&gt;&lt;LI&gt;is it a 1 to 1 relationship between "create" events and and "processing" events&lt;/LI&gt;&lt;LI&gt;what's the maximum time difference between those two events&lt;/LI&gt;&lt;LI&gt;does it matter more if a file gets created but not processed, or does that situation matter less, or is this actually the only thing that matters&lt;/LI&gt;&lt;LI&gt;do you already have the filename being extracted as a field in these two events&lt;/LI&gt;&lt;LI&gt;how often do you expect the pair of messages (daily?&amp;nbsp; hourly?&amp;nbsp; hundreds per second?)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The reason for so many questions is that there are quite a few ways to approach this, some may be better in certain circumstances, some may be better in others.&lt;/P&gt;&lt;P&gt;All in all, the details matter, but I'm sure if we get good answers to those (and perhaps a sample of the two events too) that we'll get you on your way soon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Feb 2024 22:32:13 GMT</pubDate>
    <dc:creator>Richfez</dc:creator>
    <dc:date>2024-02-05T22:32:13Z</dc:date>
    <item>
      <title>Splunk alert based on condition match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676639#M231398</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have two splunk search -1, search-2&lt;/P&gt;&lt;P&gt;i have to create splunk alert for search-2 based on search-1. If search-1 count greater than 0 then trigger search-2 alert&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vch&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 20:02:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676639#M231398</guid>
      <dc:creator>Vch</dc:creator>
      <dc:date>2024-02-05T20:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk alert based on condition match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676641#M231399</link>
      <description>&lt;P&gt;My first reasonable thought is that you just need to rewrite the two searches and combine them into one.&lt;/P&gt;&lt;P&gt;We can help with this!&amp;nbsp; What do you have for search 1 and search 2 right now?&lt;/P&gt;&lt;P&gt;(Don't forget to use the &amp;lt;code&amp;gt; button to paste searches, and if you have to obfuscate a bit of it, feel free - but try to keep the same structure to the searches!)&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 20:20:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676641#M231399</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2024-02-05T20:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk alert based on condition match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676651#M231401</link>
      <description>&lt;P&gt;search1:&amp;nbsp;index="*" sourcetype="*" "Generating Event gz File for*"&lt;/P&gt;&lt;P&gt;search2:&amp;nbsp;index="*" sourcetype="*" "File Processed*"&lt;/P&gt;&lt;P&gt;if search1 results greater than 0 then only search2 alert should trigger email alert.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 21:03:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676651#M231401</guid>
      <dc:creator>Vch</dc:creator>
      <dc:date>2024-02-05T21:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk alert based on condition match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676665#M231406</link>
      <description>&lt;P&gt;Great.&amp;nbsp; Those two searches should be able to be easily combined into one.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, I've thought about this and I'm not sure I have quite enough information yet because I feel there's a *lot* still left unsaid.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it would be great if you could describe the use case in a little more detail just using words and English, ignoring how you think the Splunk solution will be formulated.&lt;/P&gt;&lt;P&gt;I'm guessing something like - "whenever a new gz file is created, we need to check if that file was also processed or not and send an email with that information as an alert."&amp;nbsp; That leaves as open questions&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;how long is the time period involved&lt;/LI&gt;&lt;LI&gt;how often will you have this alert scheduled for (different from the first question!)&lt;/LI&gt;&lt;LI&gt;is it a 1 to 1 relationship between "create" events and and "processing" events&lt;/LI&gt;&lt;LI&gt;what's the maximum time difference between those two events&lt;/LI&gt;&lt;LI&gt;does it matter more if a file gets created but not processed, or does that situation matter less, or is this actually the only thing that matters&lt;/LI&gt;&lt;LI&gt;do you already have the filename being extracted as a field in these two events&lt;/LI&gt;&lt;LI&gt;how often do you expect the pair of messages (daily?&amp;nbsp; hourly?&amp;nbsp; hundreds per second?)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The reason for so many questions is that there are quite a few ways to approach this, some may be better in certain circumstances, some may be better in others.&lt;/P&gt;&lt;P&gt;All in all, the details matter, but I'm sure if we get good answers to those (and perhaps a sample of the two events too) that we'll get you on your way soon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 22:32:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676665#M231406</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2024-02-05T22:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk alert based on condition match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676722#M231423</link>
      <description>&lt;P&gt;Sorry for not being more descriptive, &amp;nbsp;both searches has different indexes.&lt;/P&gt;&lt;P&gt;i want to alert when search1 AND search2 result greater than zero.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;how long is the time period involved- only one time in a day.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;how often will you have this alert scheduled for (different from the first question!) - first and second searches can be done at same time, because right after few seconds of file received file will be processed&lt;/LI&gt;&lt;LI&gt;is it a 1 to 1 relationship between "create" events and and "processing" events - yes&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;what's the maximum time difference between those two events - maximum 1 hr 1 minute&lt;/LI&gt;&lt;LI&gt;does it matter more if a file gets created but not processed, or does that situation matter less, or is this actually the only thing that matters - yes its critical if file received( search1) and not processed (search2)&lt;/LI&gt;&lt;LI&gt;do you already have the filename being extracted as a field in these two events - yes i have&lt;/LI&gt;&lt;LI&gt;how often do you expect the pair of messages (daily?&amp;nbsp; hourly?&amp;nbsp; hundreds per second?) - daily once&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Tue, 06 Feb 2024 11:29:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676722#M231423</guid>
      <dc:creator>Vch</dc:creator>
      <dc:date>2024-02-06T11:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk alert based on condition match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676738#M231431</link>
      <description>&lt;P&gt;Oh lovely, the "once per day" does wonders for simplifying the problem's edges.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So there's a few different ways to handle this then.&amp;nbsp; Let's go through some options. I think our base search will be something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="a" sourcetype="x" "Generating Event gz File for*") OR (index="b" sourcetype="y" "File Processed*")&lt;/LI-CODE&gt;&lt;P&gt;I'm giving you the search piece by piece, with the idea you'll paste each piece in, see what the results are (perhaps with something like `| table *` after it), so you understand what it's doing before you add the next piece.&amp;nbsp; (Note some are "add this to the end" and others are "replace the last one with this one", so just be aware)&lt;/P&gt;&lt;P&gt;Anyway, that's what many of us call a 'data salad'.&amp;nbsp; Splunk handles messy stuff just fine.&amp;nbsp; Toss it all in the salad, then later we'll add croutons and dressing.&amp;nbsp; That should give you all the data - both sides of it.&lt;/P&gt;&lt;P&gt;Now, from here you could do something as simple as counting the results.&amp;nbsp; Add this to the end.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count&lt;/LI-CODE&gt;&lt;P&gt;If all is well you will have an answer of 2.&amp;nbsp; If the process is broken you may get 1, and if it's not run yet today you'll get 0.&amp;nbsp; This could be used as is, but I feel it's rather plain and the alert will be sort of dumb and uninteresting and without context.&lt;/P&gt;&lt;P&gt;The dumb way to make it interesting at the end is eval the count so it says words.&amp;nbsp; Add this to the end:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval status = case(if(count==2), "Everything processed correctly.",
    if(count==1, "Danger Will Robinson, it didn't process right!",
    true(), "I don't know what's going on, nothing came in today at all!")&lt;/LI-CODE&gt;&lt;P&gt;Now when you run it, you'll get some words that would possibly be useful in the alert!&lt;/P&gt;&lt;P&gt;But this is still just kind of "not using the information we have available"&lt;/P&gt;&lt;P&gt;So, replacing the entire | stats ... through the end with this new stats + stuff (eg after the base search at the top):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval generated = if(searchmatch("Generating Event gz File for"), 1,0)
| eval processed = if(searchmatch("File Processed"), 1,0)
| stats count(generated) AS generated, count(processed) AS processed BY filename
| eval status = case(generated == 1 AND processed == 1, "Received and Processed " . Filename,
    generated == 1 AND processed = 0, "NOT PROCESSED " . filename,
    true(), "Nothing reported at all")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What that does is, before we stats we create some fields (generated and processed) with a 0 or 1 in them (e.g. false or true).&amp;nbsp; We group those by filename (just in case!) with the stats, then create a "status" field that's got some information plus the filename.&lt;/P&gt;&lt;P&gt;It should work?&amp;nbsp; I mean, I don't have your data but at least it generates no errors.&amp;nbsp; Feel free to break it down - start by adding the two evals to see that THEY work right, then add the stats to see if it counts right, etc...&lt;/P&gt;&lt;P&gt;Let me know what else this might need to do!&amp;nbsp; We could include a time so that you could run historical reports... there's all sorts of other things you could do with it.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 13:27:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676738#M231431</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2024-02-06T13:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk alert based on condition match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676905#M231480</link>
      <description>&lt;P&gt;Thank you so much. This is really awesome .&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 23:19:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-alert-based-on-condition-match/m-p/676905#M231480</guid>
      <dc:creator>Vch</dc:creator>
      <dc:date>2024-02-07T23:19:35Z</dc:date>
    </item>
  </channel>
</rss>

