Page 1 of 1

Keeping only 2 weeks of events

Posted: Fri Dec 09, 2005 4:42 pm
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.

Re: Keeping only 2 weeks of events

Posted: Fri Dec 09, 2005 6:36 pm
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

Posted: Sun Dec 11, 2005 10:39 am
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?

Posted: Mon Dec 12, 2005 10:20 am
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

Posted: Mon Dec 12, 2005 8:12 pm
by SyRenity
Hi.

Thanks for the cron tip. Doesn't the zmfilter.pl auto-restarted by zmdc.pl, thought?

Posted: Mon Dec 12, 2005 9:16 pm
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

Posted: Mon Dec 12, 2005 9:17 pm
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