Filters not deleting events

Forum for questions and support relating to the 1.30.x releases only.
Post Reply
justynnuff
Posts: 4
Joined: Sat Apr 29, 2017 5:10 am

Filters not deleting events

Post by justynnuff » Sat Apr 29, 2017 5:20 am

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?

justynnuff
Posts: 4
Joined: Sat Apr 29, 2017 5:10 am

Re: Filters not deleting events

Post by justynnuff » Sat Apr 29, 2017 5:20 am

I forgot to mention that I see no output in the logs from zmaudit.pl when I execute my filter.

User avatar
iconnor
Posts: 1228
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Filters not deleting events

Post by iconnor » Sat Apr 29, 2017 1:38 pm

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?

justynnuff
Posts: 4
Joined: Sat Apr 29, 2017 5:10 am

Re: Filters not deleting events

Post by justynnuff » Mon May 01, 2017 1:50 am

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?

mikb
Posts: 462
Joined: Mon Mar 25, 2013 12:34 pm

Re: Filters not deleting events

Post by mikb » 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.

justynnuff
Posts: 4
Joined: Sat Apr 29, 2017 5:10 am

Re: Filters not deleting events

Post by justynnuff » Mon May 01, 2017 6:41 pm

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!

bbunge
Posts: 2676
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Filters not deleting events

Post by bbunge » Mon May 01, 2017 11:34 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest