logrotate cron awstats apache

vim /etc/logrotate.d/rsyslog

vim /etc/logrotate.conf

/etc/cron.daily/awstats

#!/bin/sh
/usr/share/awstats/tools/update.sh && /usr/share/awstats/tools/buildstatic.sh

/etc/logrotate.d/apache2

/var/log/apache2/*.log {
    weekly    
    missingok
    rotate 1
    compress
    delaycompress
    notifempty
    create 640 root adm 
    sharedscripts
 
Tags

logcheck

  1. ai logcheck syslog-summary
  2. rm /etc/logcheck/logcheck.logfiles.d/syslog.logfiles

vim /etc/logcheck/logcheck.conf

SYSLOGSUMMARY=1
ATTACKSUBJECT="Security Alerts"
SECURITYSUBJECT="Security Events"
EVENTSSUBJECT="System Events"
Tags

journalctl

/etc/systemd/journald.conf

Storage=auto
SystemMaxUse=1G
MaxRetentionSec=1week
ForwardToSyslog=no
  1. sc-restart systemd-journald
  2. du -sch /var/log/journal
  3. sc-failed
  4. omz plugin info systemd
  5. journalctl -p err -b
     
Tags

logwatch

  1. zless /usr/share/doc/logwatch/HOWTO-Customize-LogWatch.gz
  2. vim /usr/share/logwatch/default.conf/logwatch.conf
    • Detail = Med
  3. logwatch --service http --range today
  4. vim /etc/cron.daily/00logwatch
    • /usr/sbin/logwatch --mailto root

vim ~/.forward

srvlog@DOM.TLD 
 

Tags

awstats

  1. https://tecadmin.net/install-awstats-apache-log-analyzer-on-ubuntu/
  2. cp /usr/share/doc/awstats/examples/apache.conf /etc/apache2/conf-available/awstats.conf
  3. a2enconf awstats
  4. a2enmod cgi remoteip
  5. mkdir /var/lib/awstats/DOMAIN 
  6. chmod go+w /var/lib/awstats/DOMAIN
  7. vim /etc/awstats/awstats.DOMAIN.conf
  8. /etc/cron.daily/awstats

/etc/awstats/awstats.DOM.TLD.conf

Include "/etc/awstats/awstats.conf"
Sit
Tags

fail2ban status script

#!/bin/sh

list=$(fail2ban-client status | grep list | cut -d ":" -f2 | tr -d ',')

for i in $list; do
    fail2ban-client status $i
done

Tags

pflogsum

crontab -e

59 23 * * *    /usr/sbin/pflogsumm -d today /var/log/mail.log | mail -s "pflogsum daily Report `date`" log@DOM.TLD
0 1 * * mon    /usr/sbin/pflogsumm /var/log/mail.log.1 | mail -s "pflogsum weekly Report `date`" log@DOM.TLD

nginx netdata

server {
    server_name    netdata.TLD;

    add_header Strict-Transport-Security "max-age=7200";

logging

  1. ai rsyslog
  2. timedatectl
  3. timedatectl set-timezone Europe/Vienna
Tags