Automatically clear old events

Support and queries relating to all previous versions of ZoneMinder
Locked
cesarkallas
Posts: 3
Joined: Tue Oct 23, 2007 12:58 pm
Contact:

Automatically clear old events

Post by cesarkallas »

Hi guys,

I would like know how to schedule the ZoneMinder to automaticatilly clear old events (and not archived) when the disk usage is 90%.

I saw that ZM has one filter which do it, but how I can schedule it to run automatically.

ps. My ZM was down because the partition is 100%.


Thanks!
haus
Posts: 213
Joined: Thu Oct 11, 2007 5:10 am

Post by haus »

Bring up the filter window, select "PurgeWhenFull", and hit "Save". In the box that pops up, select "Run filter in background" (the checkbox) and hit "Save".
cesarkallas
Posts: 3
Joined: Tue Oct 23, 2007 12:58 pm
Contact:

Post by cesarkallas »

Do you know why the ZM does not erase the events on the disc ? Only delete from the database?
haus
Posts: 213
Joined: Thu Oct 11, 2007 5:10 am

Post by haus »

No, but I wonder if it relates to this from the "System" tab in options:

ZM_OPT_FAST_DELETE

Normally an event created as the result of an alarm consists of entries in one or more database tables plus the various files associated with it. When deleting events in the browser it can take a long time to remove all of this if your are trying to do a lot of events at once. It is recommended that you set this option which means that the browser client only deletes the key entries in the events table, which means the events will no longer appear in the listing, and leaves the zmaudit daemon to clear up the rest later.

I'm just learning ZM so all this is new to me. :)

edit: this may only relate to manual deletion of events via a browser, not from a background-running filter. I'm sure the ZM wizards here will have a better answer. In theory not only should the database entries be deleted, but so should the jpg files that make up the event. I wonder if you didn't wait long enough for zmaudit to notice the deleted database events and then delete the corresponding image files? The default is 15 minutes.
User avatar
MJN
Posts: 251
Joined: Wed Jan 17, 2007 10:29 am
Location: Wiltshire, UK

Post by MJN »

You're spot on (see, you're an expert!)

Something worth noting (which is mentioned in the docs) - make sure any delete rule is limited to only run on a limited number of events (e.g. 'Limit to first 5 results' is the default I think for the shipped purge rule) otherwise, if no limit is set then as soon as your partition reaches 90% the filter will match against all events and subsequently delete the whole lot!

Restricting the filter to, say, 5 events means that it'll only delete 5 (and the oldest 5 if set to list by ascending ID) at a time. If deleting those 5 still leaves it over 90% then the next 5 will be removed next time the filter fires (a minute later by default).

Mathew
haus
Posts: 213
Joined: Thu Oct 11, 2007 5:10 am

Post by haus »

Thanks! And a very good point about matching a limited number of events. I have a filter of my own that auto deletes anything older than 30 days; I'm hoping given that I'll never run into purgewhenfull, but I suppose an error could cause false positive detections or something similar that could fill a disk.
Locked