Log Duplicati runs in Windows Events

If Duplicati is run as an administrative level account, then when executed, this should leave Windows Event log entries that monitoring software can usually pick up:
%ScriptPath%\Duplicati_Pre.cmd:

REM Create Running Status
EVENTCREATE /T INFORMATION /L APPLICATION /SO Duplicati /ID 205 /D "%DUPLICATI__BACKUP_NAME% - Starting Duplicati Backup Job"

%ScriptPath%\Duplicati_Post.cmd:

REM Create Result Status from Parsed Results

SET DSTATUS=%DUPLICATI__PARSED_RESULT%
If %DSTATUS%==Fatal GOTO DSError
If %DSTATUS%==Error GOTO DSError
If %DSTATUS%==Unknown GOTO DSWarning
If %DSTATUS%==Warning GOTO DSWarning
If %DSTATUS%==Success GOTO DSSuccess
GOTO END

:DSError
EVENTCREATE /T ERROR /L APPLICATION /SO Duplicati /ID 202 /D "%DUPLICATI__BACKUP_NAME% - Error running Duplicati Backup Job"
GOTO END

:DSWarning
EVENTCREATE /T WARNING /L APPLICATION /SO Duplicati /ID 201 /D "%DUPLICATI__BACKUP_NAME% - Warning running Duplicati Backup Job"
GOTO END

:DSSuccess
EVENTCREATE /T SUCCESS /L APPLICATION /SO Duplicati /ID 200 /D "%DUPLICATI__BACKUP_NAME% - Success in running Duplicati Backup Job"
GOTO END

:END
SET DSTATUS=

In the Settings page. on the “Add advanced option”
I selected “run-script-after” and “run-script-before” Both with the full drive and path "C:\PathToScripts\Duplicati_Pre.cmd"

Thanks,
]<

2 Likes

Thanks for the great idea and script!

Would you mind if I moved (or copied) this to a #howto topic?

(By the way, I edited your post by putting “~~~” before and after the scripts to help make them stand out a bit more as well as a “`” back-tick around the cmd path.)

Thanks for making it more user friendly :slight_smile:

You can copy it anywhere it makes sense to do so.

Thanks,
]<

p.s. modified it to include the name of the backup in the event log.

We seem to have doubled up on a how-to for this so I have made “my” version unlisted.

If you somehow get here please see the active topic instead at:

Sorry, I looked in the HowTo and didn’t see it, I thought maybe I misinterpreted your message and you were asking me to do it, so I did.

Heh, don’t worry about it - it’s out there and that’s the important part. :slight_smile: