Very old post, but as I find myself in same situation again, I will document my solution here this time. May help someone or at least my future self.
First to answer OP, the main and only way to control the diff generation with OSSEC itself is the report_changes
parameter on <directories>
element in your ossec.conf
file. For example:
<directories report_changes="yes" realtime="yes" check_all="yes">/etc,/usr/bin,/usr/sbin</directories>
<directories report_changes="yes" realtime="yes" check_all="yes">/bin,/sbin,/boot</directories>
The report_changes
param is what tells ossec to create a diff for each file in that directory. That diff is created each time a file is changed. So you can imagine why the diff dir gets huge over time.
Unfortunately there is no other way to control that with ossec itself. It's up to you to cleanup the diff folder yourself or just disable reporting on folders that get too big.
I chose the first option: cleanup the diff folder myself. For that I created a simple bash script that I run with daily cron. It goes something like this:
DIFFPATH=/var/ossec/queue/diff/local
KEEP_DAYS=365
# find all files which name starts with 'state' or 'diff', not modified in last 365 days
for $file in $(find $DIFFPATH -type f -name '[state|diff]*' -mtime +$KEEP_DAYS)
do
rm $file
done
Note that this does not delete directories, nor the last-entry file. Only the files diff.1583679666
and state.1583679666
files are deleted. So you will still keep the latest version, even if its very old.