BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
podarum
Quartz | Level 8

Hi, I am running a scheduled SAS job each day in the VDI (Virtual Desktop) and I would like to know if there is a creative way to notify me (either though email or other) if the daily job ran successful or not.. If there is success then I leave it as is, if it's not then I have to go in and manually re-run it.  Perhaps a way that notifies me if there are more then 6 error messages (6 is normal as there is a connection error I always get) then send a notification?  Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Quentin
Super User

Hi,

 

How are you scheduling the job?

 

Typically, the scheduler (LSF or whatever) should make it easy to say "if job fails, then email me" when you set up the job.

 

But for a rule like "if there are more than 6 error messages," you'll likely need to write your own log scanning to count errors.  So either at the end of the job, or in a separate scheduled job, you read in the log (it's just a text file) as data, and parse it to look for error messages (and bad notes and bad warnings) and count them up.  If you search lexjansen.com for "log scanner" or "log parser" you should find lots of examples of approaches to log scanning, and emailing as well.

 

The setup I use is at the end of every scheduled job, I parse the log and then append a summary record to a joblog.sas7bdat dataset which has the name of the job, the time it ran, the number of errors detected, and other job metadata.  And every night I have a job that checks that dataset to make sure every expected job has run, and that all jobs completed without errors.  It any errored, it emails me a little report.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.

View solution in original post

1 REPLY 1
Quentin
Super User

Hi,

 

How are you scheduling the job?

 

Typically, the scheduler (LSF or whatever) should make it easy to say "if job fails, then email me" when you set up the job.

 

But for a rule like "if there are more than 6 error messages," you'll likely need to write your own log scanning to count errors.  So either at the end of the job, or in a separate scheduled job, you read in the log (it's just a text file) as data, and parse it to look for error messages (and bad notes and bad warnings) and count them up.  If you search lexjansen.com for "log scanner" or "log parser" you should find lots of examples of approaches to log scanning, and emailing as well.

 

The setup I use is at the end of every scheduled job, I parse the log and then append a summary record to a joblog.sas7bdat dataset which has the name of the job, the time it ran, the number of errors detected, and other job metadata.  And every night I have a job that checks that dataset to make sure every expected job has run, and that all jobs completed without errors.  It any errored, it emails me a little report.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 627 views
  • 1 like
  • 2 in conversation