Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
kb1
Collaborator

is there a way to clear up old log oon the management server?

df -kh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_splat-lv_current 70G 25G 46G 35% /
/dev/sda1 291M 54M 222M 20% /boot
tmpfs 16G 4.0K 16G 1% /dev/shm
/dev/mapper/vg_splat-lv_log 1.5T 1.3T 226G 85% /var/log

so as you can see 85% logs have been used up, so in order to prepare for when it gets completely used i think we would have to delete the older logs, or maybe first backup the old logs to some other location(if possible) and then delete old logs to free up space, so would be great if there was a way to free them up starting from old logs.

 

Thanks and Regards.

0 Kudos
3 Replies
PhoneBoy
Admin
Admin

This should happen by default and you can configure the precise thresholds in the management object.
0 Kudos
MartinTzvetanov
Advisor

This is a script I use on few of our customers:
#####################################
#!/bin/bash
echo "Usage: zip-logs.sh year month in format yyyy mm"
if [ $# -ne 2 ];
then
echo "No input arguments"
echo "Usage: zip-logs.sh year month in format yyyy mm"
exit 1
fi

echo "you entered year: $1 and month: $2"

LOGDIR=/etc/fw/log/
#LOGDIR=/home/admin/cp-logs
echo "Log dir is $LOGDIR"

nfiles=find . -name "$1-$2-??*log*" | wc -l

if [ $nfiles -eq 0 ];
then
echo "No logs found for this period"
exit 1
fi

echo "Archiving logs for $2 month of year $1" && /bin/tar -c --checkpoint=.1000 --checkpoint-action=dot -zf old_$1-$2-logs.tgz $1-$2-??log
#&& echo "Deleting the archived logs" && rm $1-$2-??log

#####################################

For example run ./zip-logs.sh 2019 01 and it will tar gz all the logs for January 2019. If you uncomment the last line the script will also delete the files that are already being targz-ed.
0 Kudos
inyakis
Explorer

Hello Martin,

I have been trying to run your script without success.

I wonder if you could share an update version for the R80.40?

Thanks a lot,

 

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events