Documentation, alternatives.log kickout
This commit is contained in:
parent
65b5b20b18
commit
6dcc7eb8e0
19
README.MD
19
README.MD
@ -30,7 +30,7 @@ All configuration options can be found in the `backup.cfg` file. The script has
|
||||
| vhost_backup | true/false | Backup of the vhost configuration |
|
||||
| vhost_dir | ------> | Path to the vhost files |
|
||||
| log_backup | true/false | Backup log files |
|
||||
| log_to_backup |array | Array of logs to backup, options: apache, nginx, fail2ban, alternatives, pckg_mngr, auth, dmesg, dpkg, letsencrypt, php, syslog, purge (truncate all)|
|
||||
| log_to_backup |array | Array of logs to backup, see below for options|
|
||||
| rsync_push | true/false | Push the backup file to a remote server |
|
||||
| push_clean | true/false | Delete the backup file after push |
|
||||
| target_host | ------> | Backup push target host |
|
||||
@ -49,6 +49,23 @@ All configuration options can be found in the `backup.cfg` file. The script has
|
||||
| db_all | ------> | Dump all databases instead of specific one |
|
||||
|
||||
|
||||
## Logs to backup array 📚
|
||||
|
||||
| Option | Specifics |
|
||||
| apache | Apache access and error logs |
|
||||
| nginx | Nginx access and error logs |
|
||||
| fail2ban | Fail2ban log |
|
||||
| alternatives | Alternatives log |
|
||||
| pckg_mngr | Logs from Yum/Apt package manager |
|
||||
| auth | Authentications log |
|
||||
| dmesg | Kernel log |
|
||||
| dpkg | Package changes log |
|
||||
| letsencrypt | Let's encrypt logs |
|
||||
| php | Logs from all installed PHPs |
|
||||
| syslog | System event data |
|
||||
| purge | Empty all the logs after backing up |
|
||||
|
||||
|
||||
## Script Execution 🪄
|
||||
|
||||
|
||||
|
@ -9,8 +9,8 @@ www_dir='xyz' # wwwroot location
|
||||
vhost_backup=false # backup vhost config
|
||||
vhost_dir='/etc/httpd/sites-enabled' # vhost location
|
||||
log_backup=false # backup logs
|
||||
log_to_backup=("apache" "nginx" "fail2ban" "alternatives" "pckg_mngr" "auth" "dmesg" "dpkg" "letsencrypt" "php" "syslog" "purge")
|
||||
# logs to backup, options: apache, nginx, fail2ban, alternatives, pckg_mngr, auth, dmesg, dpkg, letsencrypt, php, syslog, purge (truncate all))
|
||||
log_to_backup=("apache" "nginx" "fail2ban" "pckg_mngr" "auth" "dmesg" "dpkg" "letsencrypt" "php" "syslog" "purge")
|
||||
# logs to backup, options: apache, nginx, fail2ban, pckg_mngr, auth, dmesg, dpkg, letsencrypt, php, syslog, purge (truncate all))
|
||||
rsync_push=false # enable push to remote server
|
||||
push_clean=false # clean backup file after push
|
||||
target_host="127.0.0.1" # rsync target host
|
||||
|
16
main.sh
16
main.sh
@ -89,11 +89,6 @@ function logbackup {
|
||||
cp -r /var/log/nginx "$tmpdir/nginxlogs"
|
||||
fi
|
||||
|
||||
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[alternatives]} " ]]; then
|
||||
mkdir -p "$tmpdir/syslogs/"
|
||||
cp -r /var/log/alternatives.log "$tmpdir/syslogs/"
|
||||
fi
|
||||
|
||||
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[pckg_mngr]} " ]]; then
|
||||
mkdir -p "$tmpdir/syslogs/"
|
||||
mkdir -p "$tmpdir/syslogs/yum"
|
||||
@ -146,9 +141,6 @@ function logbackup {
|
||||
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[fail2ban]} " ]]; then
|
||||
truncate -s 0 /var/log/fail2ban.log
|
||||
fi
|
||||
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[alternatives]} " ]]; then
|
||||
truncate -s 0 /var/log/alternatives.log
|
||||
fi
|
||||
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[pckg_mngr]} " ]]; then
|
||||
truncate -s 0 /var/log/yum/*
|
||||
fi
|
||||
@ -189,11 +181,6 @@ function logbackup {
|
||||
cp -r /var/log/nginx "$tmpdir/nginxlogs"
|
||||
fi
|
||||
|
||||
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[alternatives]} " ]]; then
|
||||
mkdir -p "$tmpdir/syslogs/"
|
||||
cp -r /var/log/alternatives.log "$tmpdir/syslogs/"
|
||||
fi
|
||||
|
||||
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[pckg_mngr]} " ]]; then
|
||||
mkdir -p "$tmpdir/syslogs/"
|
||||
mkdir -p "$tmpdir/syslogs/apt"
|
||||
@ -246,9 +233,6 @@ function logbackup {
|
||||
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[fail2ban]} " ]]; then
|
||||
truncate -s 0 /var/log/fail2ban.log
|
||||
fi
|
||||
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[alternatives]} " ]]; then
|
||||
truncate -s 0 /var/log/alternatives.log
|
||||
fi
|
||||
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[pckg_mngr]} " ]]; then
|
||||
truncate -s 0 /var/log/apt/*
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user