Not sure if this helps, but I'll post a script of something we do for job checking. It appears as though you are logging everything to a file. We have elected to log everything to tables, so we can track them over time, manipulate the data in T-SQL, etc. We log to a local database on each server, DBA, then DTS the data nightly to a repository for all servers, DBA_Repository. Then we do some reporting via reporting services, and setup subscriptions, etc. Anyway, here's the job_status script (thanks also to Dennis Vroom for help with this). When we have no failures, it produces no rows in the table. SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GOuse DBAgoif exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_get_job_status]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[usp_get_job_status]GOCREATE PROCEDURE usp_get_job_status/*Author: Jon BakerDate : 7/25/2005Paramaters : NoneTest Data :usp_get_job_statusselect * from dba.dbo.dba_job_statusPurpose : To collect data for daily monitoring of job statusRevisions :*/ASset nocount onDECLARE @rc intDECLARE @errmsg varchar (256)--If the logging table does not exist, create itif not exists (select 1 from dba.dbo.sysobjects where xtype = 'u' and name = 'dba_job_status')BEGIN CREATE TABLE dbo.dba_job_status ( collect_time datetime not null, server_name sysname not null, instance_id int not null, job_name sysname null, step_name sysname null, message nvarchar(2048) null, run_date int null, run_time int null, run_duration int null, CONSTRAINT PK_dba_job_status PRIMARY KEY (collect_time desc, instance_id desc) ) if @@error <> 0 BEGIN set @errmsg = 'create table failed!' goto ERRORPROC END ENDdeclare @now datetimeset @now = getdate()declare @max_instance_id intset @max_instance_id = isnull((select max(instance_id) from dbo.dba_job_status),0)INSERT INTO [DBA].[dbo].[dba_job_status]( [collect_time], [server_name], [instance_id], [job_name], [step_name], [message], [run_date], [run_time], [run_duration])SELECT @now, @@servername, H.instance_id, J.name, H.step_name, H.message, H.run_date, H.run_time, H.run_duration from msdb.dbo.sysjobs J join msdb.dbo.sysjobhistory H on J.job_id=H.job_id where H.run_status=0 and H.instance_id>@max_instance_id order by H.instance_id descif @@error <> 0 BEGIN set @errmsg = 'INSERT failed!' goto ERRORPROC ENDELSE goto ENDPROCERRORPROC: BEGIN RAISERROR (@errmsg, 16, 1) RETURN (-1) ENDENDPROC: BEGIN Return (0) END
If you visit my blog (see signature), I actually talked more about this solution recently.HTHJon-Like a kidney stone, this too shall pass.http://www.sqljunkies.com/weblog/outerjoin