Add logging

This commit is contained in:
Christopher
2023-08-15 09:01:31 -05:00
parent 15be8c2c3f
commit b9c825d77c

View File

@@ -75,6 +75,30 @@ echo " access-control: ::1 allow_snoop # Allow IPv6 localhost to snoop" | su
echo " access-control: 127.0.0.0/8 allow # Allow entire localhost subnet" | sudo tee -a /etc/unbound/unbound.conf.d/main.conf
echo " access-control: $SUBNET/24 allow # Allow current local subnet" | sudo tee -a /etc/unbound/unbound.conf.d/main.conf
# Logging configurations
cat <<EOF | sudo tee /etc/rsyslog.d/unbound.conf
# Log messages generated by the unbound application
if $programname == 'unbound' then /var/log/unbound.log
# Stop processing it further
& stop
EOF
# Configuration for log rotation
cat <<EOF | sudo tee /etc/logrotate.d/unbound
/var/log/unbound.log {
daily
rotate 7
missingok
create 0640 root adm
postrotate
/usr/lib/rsyslog/rsyslog-rotate
endscript
}
EOF
# Restart the rsyslog and logrotate services to apply changes
sudo systemctl restart rsyslog logrotate
# echo -e "\n${GREEN}Updating the sysctl configuration...${NC}"
# echo "net.core.rmem_max=8388608" | sudo tee -a /etc/sysctl.conf