Page 1 of 1

Filter is not working

Posted: Sun Jan 19, 2025 5:54 pm
by Andrey_bk
Run sudo zmfilter.pl -f <yourfiltername> from command line
zmfilter.pl -f <PurgeWhenFull>

The command line returns:
-bash: syntax error near unexpected token «newline»

Where can I find out more about why the filter doesn't work?

Re: Filter is not working

Posted: Sun Jan 19, 2025 10:44 pm
by dougmccrary
zmfilter.pl -f PurgeWhenFull

Re: Filter is not working

Posted: Mon Jan 20, 2025 6:38 am
by Andrey_bk
zmfilter.pl -f PurgeWhenFull
In this case, I get return:

Code: Select all

Option f is ambiguous (filter, filter_id)
Usage:
    zmfilter.pl [-f <filter name>,--filter=<filter name>]
    [--filter_id=<filter id>] | -v, --version

Options:
    -f{filter name}, --filter={filter name} - The name of a specific filter
    to run --filter_id={filter id} - The id of a specific filter to run -v,
    --version - Print ZoneMinder version

Re: Filter is not working

Posted: Tue Jan 21, 2025 1:04 am
by dougmccrary
Huh. Well this works for me:
sudo zmfilter.pl --filter=PurgeWhenFull

Seems there's a bug with [-f]

Re: Filter is not working

Posted: Tue Jan 21, 2025 7:46 am
by Andrey_bk
Yes, thank you, it works. I also noticed that if there is a space in the filter name, it should be enclosed in single quotes ''.
For example:

Code: Select all

zmfilter.pl --filter='Update DiskSpace'
Now I get the output, but how do I understand why the filter is not working?

Code: Select all

root@DATASERVER:~# zmfilter.pl --filter=PurgeWhenFull-HDD-Hitachi
21.01.2025 10:34:25.247713 zmfilter[10377].INF [main:181] [Scanning for events using filter 'PurgeWhenFull-HDD-Hitachi']
Here are my filter settings:
Image

Re: Filter is not working

Posted: Tue Jan 21, 2025 8:50 am
by dougmccrary
That looks good, assuming you've got "Delete all matches" checked.

I take it you've set disk percent at 10 for testing purposes?

You might not notice it working on a single pass - maybe try setting "Limit to first" at 1000 instead of 100?

Re: Filter is not working

Posted: Tue Jan 21, 2025 9:29 am
by Andrey_bk
Yes, I set it to 10% for testing. The disk is 12% full and there are 288 events in the database. I expect 100 events to be deleted but it doesn't. And even if I run the filter manually from the terminal, nothing happens.
Yes, there is an option "Delete all matches" checked.

Re: Filter is not working

Posted: Tue Jan 21, 2025 10:10 am
by dougmccrary
Does this drive have reserved space? Default is 5%, so maybe the drive is really at 7%.

Re: Filter is not working

Posted: Tue Jan 21, 2025 11:22 am
by Andrey_bk
Yes, you are right. I reduced the threshold to 5% and the filter worked. Thank you.

Re: Filter is not working

Posted: Tue Jan 21, 2025 10:24 pm
by dougmccrary
:D
you may want to look into the tune2fs command, especially if hitachi is data only.

Re: Filter is not working

Posted: Wed Jan 22, 2025 9:17 am
by Andrey_bk
Great! I didn't know about that. It came in handy. Respect.
Set to 0% redundancy because this disk is only used for ZM

Code: Select all

tune2fs -m 0 /dev/sdb1

Re: Filter is not working

Posted: Wed Jan 22, 2025 11:00 am
by dougmccrary
😎