Page 1 of 1

Filters not deleting events

Posted: Sat Apr 29, 2017 5:20 am
by justynnuff
Hi,

Let me just say that this program is incredible. It's helping me out very much in a struggling time.

The only thing that isn't working is when I set up a filter to delete old events, it doesn't work.

I set up a filter to delete "Date" "less than or equal to" "-2 days", sort by ID ascending, and limit to 1000 events (that many events just for the sake of getting rid of old crap). I also, obviously, select "Delete all matches".

When I hit submit, it takes me to the correct events, but when I hit "execute", nothing happens.

I have other filters running just fine (I get emails with non-zero alert frame events), so I know that part is working. It just seems like the deletion part is not working.

I've been scouring around trying to find solutions, and I've tried the following:

Running zmaudit.pl yields no output.
RUN_AUDIT is enabled
AUDIT_MIN_AGE is 86400
OPT_FAST_DELETE is disabled.
When I hit execute, the logs show the following:
2017-04-29 01:07:34.731750 zmfilter 14921 INF Scanning for events using filter '_TempFilter1493442454' zmfilter.pl
(weird that it shows the temp filter, and not the filter I named)

I really want to only keep a 2 day window of images on my server, but I can't seem to get it to work. I've been fighting with ZM for a while, customizing it, and getting it perfect, and so far, it's been a fight, but I've been winning. It's been fun and this is what I like to do, but in this circumstance, I'm kind of at a deadpass.

Any suggestions?

Re: Filters not deleting events

Posted: Sat Apr 29, 2017 5:20 am
by justynnuff
I forgot to mention that I see no output in the logs from zmaudit.pl when I execute my filter.

Re: Filters not deleting events

Posted: Sat Apr 29, 2017 1:38 pm
by iconnor
The output will be in zmfilter.pl. zmaudit only does the deleting when OPT_FAST_DELETE is on.

The tempfilter thing is just how zm does things.. A hack, but not the problem.

Is it set to run in the background?

Re: Filters not deleting events

Posted: Mon May 01, 2017 1:50 am
by justynnuff
Yes it's set to run in the background.

I'll try to execute zmfilter from console when I get home and update. Does the formatting of the filter look correct? The less than/greater than along with plus or minus days is a tiny bit confusing to me.

Could you give me the correct formatting for deleting events greater than 10 minutes (for example) so I could debug what's going on without waiting for days of events to accumulate? I know "date" changes to "date/time" but the other information would be informative to me.

Above when I mentioned that ZM emails me with non zero alert frames, that is correctly running in the background, so I think I'm doing that fine. I was thinking it might be a permissions thing from the web interface, since submit works, but execute doesn't. I double checked permissions of the directory on my filesystem (I messed that up before, saw the logs, and now it correctly writes to the dir), but how can I verify www-data can actually delete events from the db. Maybe that's the problem?

Re: Filters not deleting events

Posted: Mon May 01, 2017 5:37 pm
by mikb
Your syntax looks ok

I use "Date" "Less Than" "7 days ago" for purging when old.

It means "older than 7 days", even though "less than 7 days" in *English* means everything within the last week :)

It's a mathematical less-than, so a date which is smaller than "7 days ago", with date "0" being way in the past.

Re: Filters not deleting events

Posted: Mon May 01, 2017 6:41 pm
by justynnuff
Well, this seems weird, but the "execute" button is indeed working. It's deleting the correct events. The only thing changed between when I posted then and now was that I had to restart my entire server. Yes, I was restarting ZM whenever I made a change with "/etc/init.d/zoneminder restart", but maybe something else was messed up with sql, or something else. Or maybe I'm just an id10t, who knows.
mikb wrote: Mon May 01, 2017 5:37 pm Your syntax looks ok

I use "Date" "Less Than" "7 days ago" for purging when old.

It means "older than 7 days", even though "less than 7 days" in *English* means everything within the last week :)

It's a mathematical less-than, so a date which is smaller than "7 days ago", with date "0" being way in the past.
This FINALLY makes sense, thank you so much. With your help understanding the syntax, and the execute filter command working properly, I think I have ZM set up perfectly for my needs.

Thank you for the awesome application and the support!

Re: Filters not deleting events

Posted: Mon May 01, 2017 11:34 pm
by bbunge
Just to let you know what works:

Date less than or equal to -30 day
and Archive Status equal to Unarchived only
Sort by Date/Time Asc Limit to first 100 results only
Delete all matches (checked)

Save to run in background

This will run after midnight your time. If there are more than 100 events to delete it will rerun until all old events are cleared

Leave OPT_FAST_DELETE checked to clean the database first. When ZM checks the events to the database it will delete images from the drive.