Keeping only 2 weeks of events

Support and queries relating to all previous versions of ZoneMinder
Locked
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Keeping only 2 weeks of events

Post by SyRenity »

Hi.

I'm looking to store only 2 weeks of events backwards, erasing any events older then 2 weeks. Any idea how to achieve this (with the filters system for example)?

Perhaps it is possible to use mysql now() operator in the condition value field, and to cause that any date less then (now() - 14 days), will be erased?

Thanks.
2tomcats
Posts: 13
Joined: Sat Oct 30, 2004 10:59 am

Re: Keeping only 2 weeks of events

Post by 2tomcats »

SyRenity wrote: erasing any events older then 2 weeks
What about defining a filter like this one:
---
"Date/Time" "less than or equal to" "-14days"
Sort by: Date/Time Desc

Automatically delete all matches:
---
Uli
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Post by SyRenity »

Hi.

Thanks! This method works great.

Does this mean that ZM always adds now() to the query, when calculating dates?


Another related question: is it possible to set the filters to run only at specified time period, say, at night?
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Yes, the date/times are always relative to when the query is run.

You can't currently limit when the filters run directly but you can increase the interval (Options->System->ZM_FILTER_EXECUTE_INTERVAL). You could probably add a cron job to start and stop the zmfilter.pl process via zmdc.pl if you really wanted to limit running to nighttimes though.

Phil
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Post by SyRenity »

Hi.

Thanks for the cron tip. Doesn't the zmfilter.pl auto-restarted by zmdc.pl, thought?
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

It does if it crashes. If you explicitly stop it with

Code: Select all

zmdc.pl stop zmfilter.pl
it should remain stopped. I can't say I've ever tried it though.

Phil
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

The other thing to possibly bear in mind is that when you do start it up again, it may have a lot of events (depending on your system) to plough through and so might slow things down a bit until it's caught up.

Phil
Locked