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.

BASUG is hosting free webinars Next up: Don Henderson presenting on using hash functions (not hash tables!) to segment data on June 12. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

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.

BASUG is hosting free webinars Next up: Don Henderson presenting on using hash functions (not hash tables!) to segment data on June 12. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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