<?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: Alert on a new source file? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Alert-on-a-new-source-file/m-p/497356#M8856</link>
    <description>&lt;P&gt;This will look for events where first event time is under 10 minutes. You can adjust the threshold age_seconds below up/down to your liking. Adjust the index and sourcetype constraints to match your actual index and sourcetype.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats min(_time) as first_time where index="*" sourcetype="*" source="*job_*" by sourcetype source 
| fields first_time index sourcetype source 
| eval current_time=now() 
| eval age_seconds=current_time-first_time 
| search age_seconds&amp;lt;=600 
| eval age=tostring(age_seconds,"duration") 
| eval age = replace(age,"(\d+)\:(\d+)\:(\d+)","\1h \2min \3s") 
| convert ctime(first_time) ctime(current_time) 
| table current_time first_time age age_seconds sourcetype source
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 29 Jan 2020 04:28:15 GMT</pubDate>
    <dc:creator>bandit</dc:creator>
    <dc:date>2020-01-29T04:28:15Z</dc:date>
    <item>
      <title>Alert on a new source file?</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-on-a-new-source-file/m-p/497355#M8855</link>
      <description>&lt;P&gt;Best way to alert on a new source file for a specific sourcetype?&lt;/P&gt;

&lt;P&gt;Bonus point if we can include the parent directory of where the source file is located.&lt;/P&gt;

&lt;P&gt;An appliance called "AWS Elemental Live" that encodes and streams video, creates a new directory and a set of logs for every scheduled event. Something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# ls -l /opt/elemental_se/web/log/10000/job_2035/
total 120
-rw-rw-r-- 1 elemental apache 36168 Jan 28 00:55 20200128T005500_emecmd.xml
-rw-rw-r-- 1 elemental apache 44368 Jan 28 02:05 20200128T005501_eme.log
-rw-rw-r-- 1 elemental apache 32955 Jan 28 02:05 20200128T005501_eme_ve.log
-rw-rw-r-- 1 elemental apache  2618 Jan 28 02:04 20200128T005501_ingest_2046.log
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I create an alert whenever that happens?&lt;/P&gt;

&lt;P&gt;The alert ideally should be something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Splunk is reporting that "job_2035" has started recording on $host$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;... (then I could try to also alert on the end of the recording if I could figure out how)&lt;/P&gt;

&lt;P&gt;(I haven't found unique or common enough events in those logs - "recording started" or some such - so I could alert on those events rather than on the source file creation. So the alert condition &lt;STRONG&gt;must&lt;/STRONG&gt; be the fact of a new source file creation.)&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 02:40:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-on-a-new-source-file/m-p/497355#M8855</guid>
      <dc:creator>mitag</dc:creator>
      <dc:date>2020-01-29T02:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: Alert on a new source file?</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-on-a-new-source-file/m-p/497356#M8856</link>
      <description>&lt;P&gt;This will look for events where first event time is under 10 minutes. You can adjust the threshold age_seconds below up/down to your liking. Adjust the index and sourcetype constraints to match your actual index and sourcetype.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats min(_time) as first_time where index="*" sourcetype="*" source="*job_*" by sourcetype source 
| fields first_time index sourcetype source 
| eval current_time=now() 
| eval age_seconds=current_time-first_time 
| search age_seconds&amp;lt;=600 
| eval age=tostring(age_seconds,"duration") 
| eval age = replace(age,"(\d+)\:(\d+)\:(\d+)","\1h \2min \3s") 
| convert ctime(first_time) ctime(current_time) 
| table current_time first_time age age_seconds sourcetype source
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jan 2020 04:28:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-on-a-new-source-file/m-p/497356#M8856</guid>
      <dc:creator>bandit</dc:creator>
      <dc:date>2020-01-29T04:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: Alert on a new source file?</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-on-a-new-source-file/m-p/497357#M8857</link>
      <description>&lt;P&gt;you can optionally add a field extraction for your Job id like so&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=source "/(?&amp;lt;job_id&amp;gt;job_\d+)/"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jan 2020 04:38:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-on-a-new-source-file/m-p/497357#M8857</guid>
      <dc:creator>bandit</dc:creator>
      <dc:date>2020-01-29T04:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Alert on a new source file?</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-on-a-new-source-file/m-p/497358#M8858</link>
      <description>&lt;P&gt;You might also tinker with the transaction command using startswith and endswith&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transaction"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transaction&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 04:52:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-on-a-new-source-file/m-p/497358#M8858</guid>
      <dc:creator>bandit</dc:creator>
      <dc:date>2020-01-29T04:52:20Z</dc:date>
    </item>
  </channel>
</rss>

