CentOS 7 - Server Commands - Apache Log Management

Wednesday, September 16th, 2020 | System

View / Clear Logs:

* add new line to end ( backslash n ) inside single quotes

cd /var/www

find . -type f -name requests.log -printf '%s %p'
find . -type f -name error.log -printf '%s %p'

cd /var/www

find . -name 'requests.log' -exec sh -c '> {}' \;
find . -name 'error.log' -exec sh -c '> {}' \;

Sort logs alphabetically:

find . -type f -name access.log -exec du -bh {} \; | sort -k 2
find . -type f -name requests.log -exec du -bh {} \; | sort -k 2
find . -type f -name error.log -exec du -bh {} \; | sort -k 2

Comments


E19 Creative

Products | Support | About | Contact | Login