≡ Menu

log files

I've Squid Proxy server with over 100 Windows workstation. I see following error message in my cache.log file:

WARNING! Your cache is running out of filedescriptors

Do I need to filter proxy server requests to avoid this problem? How do I fix this problem under CentOS / Fedora / RHEL / Debian Linux?
[click to continue…]

Q. I’m running Redhat Enterprise Linux 4.5 server along with Postfix and Cyrus mail server. However I’m getting following error in my log files:

Jun 10 18:00:04 server postfix/smtpd[7280]: sql_select option missing
Jun 10 18:00:04 server postfix/smtpd[7280]: auxpropfunc error no mechanism available

How do I fix this error? I’m not using mysql for postfix.

A. The cyrus software comes with various plugin. The cyrus-sasl-sql package contains the Cyrus SASL plugin which supports using a RDBMS for storing shared secrets.

If you are not using MySQL, just remove the plugin using rpm command:

# rpm -ev cyrus-sasl-sql

Note if you are using Debian or Ubuntu remove libsasl2-modules-sql package:
# apt-get remove libsasl2-modules-sql

Also on RHEL 3 / 4, make sure that file /etc/openldap/slapd.conf is owned by the user ldap:
# chown ldap.ldap /etc/openldap/slapd.conf

Other option is to configure the sql module. Now there should not be any sort of error in /var/log/messages or /var/log/maillog file.

I am a new Linux user. I would like to know where are the log files located under Debian/Ubuntu or CentOS/RHEL/Fedora Linux server? How do I open or view log files on Linux operating systems?
[click to continue…]

How do I rotate log files?

Q. How do I rotate log files under Linux operating system?

A. You need use tool called logrotate, which is designed to ease administration of systems that generate large numbers of log files. It allows automatic rotation, compression, removal, and mailing of log files.

Each log file may be handled daily, weekly, monthly, or when it grows too large. With this tool you keep logs longer with less disk space.

Default configuration file

The default configuration file is /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
# 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 -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
rotate 1
}
Service or server specific configurations stored in /etc/logrotate.d directory, for example here is sample apache logrotate configuration file:# cat /etc/logrotate.d/httpdOutput:

/var/log/httpd/*.log {
 weekly
 rotate 52
 compress
  missingok
  notifempty
  sharedscripts
  postrotate
      /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true    endscript
}

Where,

  • weekly : Log files are rotated if the current weekday is less then the weekday of the last rotation or if more then a week has passed since the last rotation.
  • rotate 52 : Log files are rotated 52 times before being removed or mailed to the address specified in a mail directive. If count is 0, old versions are removed rather then rotated.
  • compress : Old versions of log files are compressed with gzip to save disk space.
  • missingok : If the log file is missing, go on to the next one without issuing an error message.
  • notifempty : Do not rotate the log if it is empty
  • sharedscripts : Normally, prerotate and postrotate scripts are run for each log which is rotated, meaning that a single script may be run multiple times for log file entries which match multiple files. If sharedscript is specified, the scripts are only run once, no matter how many logs match the wildcarded pattern. However, if none of the logs in the pattern require rotating, the scripts will not be run at all.
  • postrotate
    /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript : The lines between postrotate and endscript (both of which must appear on lines by themselves) are executed after the log file is rotated. These directives may only appear inside a log file definition.

See complete working example: How to rotating logs with logrotate for Lighttpd web server.