Skip to main content
edited title
Link
overexchange
  • 1.6k
  • 10
  • 31
  • 56

Logrotate syslog-NG logging - RHEL 7.x

added 987 characters in body
Source Link
overexchange
  • 1.6k
  • 10
  • 31
  • 56
[root@machine1 output]# crontab -l
# 00 23 * * * /TSM/bkup 1>/dev/null 2>&1
1 * * * * /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
[root@machine1 output]#
[root@machine1 output]# pwd
/app/syslog-ng/custom/output
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# date
Wed Oct 10 11:26:54 EDT 2018
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# cat /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
/app/syslog-ng/custom/output/all_devices.log {
copytruncate
dateext
rotate 365
daily
sharedscripts
compress
postrotate
      /app/syslog-ng/sbin/syslog-ng-ctl reload
endscript
}
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# date
Wed Oct 10 11:29:51 EDT 2018
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]# /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]# 
[root@machine1 output]#
[root@machine1 output]# cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
dateext

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
        minsize 1M
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}

# system-specific logs may be also be configured here.
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# crontab -l
# 00 23 * * * /TSM/bkup 1>/dev/null 2>&1
1 * * * * /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
[root@machine1 output]#
[root@machine1 output]# pwd
/app/syslog-ng/custom/output
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# date
Wed Oct 10 11:26:54 EDT 2018
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# cat /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
/app/syslog-ng/custom/output/all_devices.log {
copytruncate
dateext
rotate 365
daily
sharedscripts
compress
postrotate
      /app/syslog-ng/sbin/syslog-ng-ctl reload
endscript
}
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# date
Wed Oct 10 11:29:51 EDT 2018
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]# /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]#
[root@machine1 output]# crontab -l
# 00 23 * * * /TSM/bkup 1>/dev/null 2>&1
1 * * * * /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
[root@machine1 output]#
[root@machine1 output]# pwd
/app/syslog-ng/custom/output
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# date
Wed Oct 10 11:26:54 EDT 2018
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# cat /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
/app/syslog-ng/custom/output/all_devices.log {
copytruncate
dateext
rotate 365
daily
sharedscripts
compress
postrotate
      /app/syslog-ng/sbin/syslog-ng-ctl reload
endscript
}
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# date
Wed Oct 10 11:29:51 EDT 2018
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]# /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]# 
[root@machine1 output]#
[root@machine1 output]# cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
dateext

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
        minsize 1M
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}

# system-specific logs may be also be configured here.
[root@machine1 output]#
[root@machine1 output]#
added 9 characters in body
Source Link
overexchange
  • 1.6k
  • 10
  • 31
  • 56

/usr/sbin/logrotate is used to log rotate syslog-NG logging, as shown below:

[root@machine1 output]# crontab -l
# 00 23 * * * /TSM/bkup 1>/dev/null 2>&1
1 * * * * /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
[root@machine1 output]#
[root@machine1 output]# pwd
/app/syslog-ng/custom/output
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# date
Wed Oct 10 11:26:54 EDT 2018
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# cat /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
/app/syslog-ng/custom/output/all_devices.log {
copytruncate
dateext
rotate 365
daily
sharedscripts
compress
postrotate
      /app/syslog-ng/sbin/syslog-ng-ctl reload
endscript
}
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# date
Wed Oct 10 11:29:51 EDT 2018
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]# /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]#

But, I do not see compressed file getting generated in ../output folder, every minute(crontab).

why logrotate does not generate compressed file??

/usr/sbin/logrotate is used to log rotate syslog-NG logging, as shown below:

[root@machine1 output]# crontab -l
# 00 23 * * * /TSM/bkup 1>/dev/null 2>&1
1 * * * * /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
[root@machine1 output]#
[root@machine1 output]# pwd
/app/syslog-ng/custom/output
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# date
Wed Oct 10 11:26:54 EDT 2018
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# cat /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
/app/syslog-ng/custom/output/all_devices.log {
copytruncate
dateext
rotate 365
daily
sharedscripts
compress
postrotate
      /app/syslog-ng/sbin/syslog-ng-ctl reload
endscript
}
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# date
Wed Oct 10 11:29:51 EDT 2018
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]# /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]#

But, I do not see compressed file getting generated in ../output folder, every minute.

why logrotate does not generate compressed file??

/usr/sbin/logrotate is used to log rotate syslog-NG logging, as shown below:

[root@machine1 output]# crontab -l
# 00 23 * * * /TSM/bkup 1>/dev/null 2>&1
1 * * * * /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
[root@machine1 output]#
[root@machine1 output]# pwd
/app/syslog-ng/custom/output
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# date
Wed Oct 10 11:26:54 EDT 2018
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# cat /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
/app/syslog-ng/custom/output/all_devices.log {
copytruncate
dateext
rotate 365
daily
sharedscripts
compress
postrotate
      /app/syslog-ng/sbin/syslog-ng-ctl reload
endscript
}
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# date
Wed Oct 10 11:29:51 EDT 2018
[root@machine1 output]#
[root@machine1 output]#
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]# /usr/sbin/logrotate /app/syslog-ng/custom/conf/syslog-ng-rotate.conf
[root@machine1 output]# ls -l
total 4
-rw------- 1 root root 142 Oct  3 16:08 all_devices.log
[root@machine1 output]#

But, I do not see compressed file getting generated in ../output folder, every minute(crontab).

why logrotate does not generate compressed file??

Source Link
overexchange
  • 1.6k
  • 10
  • 31
  • 56
Loading