I'm trying to get size of specified directory but exclude size of one subdirectory and files inside it. Directory structure looks like this:
I want to exclude whole 'archive' folder and all files in it. Based on documentation regex_excl is what I need.
regex_excl - regex describing the file, directory and symbolic link name pattern for exclusion (don't exclude any if empty; empty string is default value)
But using regex_excl with directory name only excludes size of directory file itself (i.e. 4096 bytes) but not whole subtree size.
Steps to reproduce:
- Create test directory structure like described above.
- Query size from Zabbix Agent
- With first request we get size of all files in target folder (/tmp/logs). du return same size.
- With second request we get size of all files excluding size of 'archive' directory file (3347012 - 3342916 = 4096 bytes). 'du' returns different result because it does not count size of files in 'archive' directory.****
- 3-rd request returns only size of 2 directory files: 'logs' and 'archive' all '*.log' files are excluded.
Based on documentation description I expect regex_excl operate same way as --exclude key of du utility, but it behaves in different, unpredictable way.