Difference between revisions of "Bering-uClibc 6.x - User Guide - Basic Configuration - Log Files"
(→Location and contents of main log files) |
(→logrotate options) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 34: | Line 34: | ||
The task of log file maintenance is accomplished by <code class="filename">/usr/bin/logrotate</code>. | The task of log file maintenance is accomplished by <code class="filename">/usr/bin/logrotate</code>. | ||
<code class="filename">logrotate</code> is started daily, weekly and monthly from <code class="filename">/etc/cron.daily/multicron-d</code>, <code class="filename">/etc/cron.weekly/multicron-w</code> and <code class="filename">/etc/cron.monthly/multicron-m</code>. | <code class="filename">logrotate</code> is started daily, weekly and monthly from <code class="filename">/etc/cron.daily/multicron-d</code>, <code class="filename">/etc/cron.weekly/multicron-w</code> and <code class="filename">/etc/cron.monthly/multicron-m</code>. | ||
+ | Log files will be compressed and rotated if a given size (default 1MB) is reached. | ||
+ | It also restarts a daemon after log rotation if needed. The files are rotated up to four generations. | ||
<code class="filename">logrotate</code> keeps the configuration files in <code class="filename">/etc/logrotate.d</code>, usually named after the application generating the log file (e.g <code class="filename">/etc/logrotate.d/ulogd</code>. | <code class="filename">logrotate</code> keeps the configuration files in <code class="filename">/etc/logrotate.d</code>, usually named after the application generating the log file (e.g <code class="filename">/etc/logrotate.d/ulogd</code>. | ||
+ | |||
+ | For the default log files (<code class="filename">syslog</code>, <code class="filename">user.log</code>, <code class="filename">cron.log</code>, <code class="filename">daemon.log</code>, <code class="filename">auth.log</code>, <code class="filename">debug</code>, <code class="filename">wtmp</code>) the logrotation configuration has been added to <code class="filename">/etc/logrotate.d/syslog</code>. | ||
====logrotate options==== | ====logrotate options==== | ||
− | + | The following example is the default logrotate.d file <code class="filename">/etc/logrotate.d/syslog</code> for <code class="filename">/var/log/syslog</code> and other common log files created by LEAF Bering-uClibc at boot time. | |
+ | |||
+ | # add files to be rotated (daily, weekly, monthly) | ||
+ | # NOTE: depends if LOGSIZE has been reached | ||
+ | LOGS_DAILY="syslog user.log daemon.log cron.log auth.log debug" | ||
+ | LOGS_WEEKLY="" | ||
+ | LOGS_MONTLY="wtmp" | ||
+ | # LOGSIZE - size in kb when logrotate move and compress log files | ||
+ | LOGSIZE=1024 | ||
+ | # DAEMON - restart this service after logrotation | ||
+ | DAEMON=syslog-ng | ||
+ | # METHOD - restart command | ||
+ | METHOD=restart | ||
+ | # USER - set user permission | ||
+ | #USER=sh-httpd | ||
+ | # GROUP - set group permission | ||
+ | #GROUP=adm | ||
+ | # if set to one the first iteration will be compressed | ||
+ | COMPRESS_ALL=1 | ||
===Using Spacecheck in lrp.conf=== | ===Using Spacecheck in lrp.conf=== |
Latest revision as of 14:32, 22 July 2017
Basic Configuration - Log Files | ||
---|---|---|
Prev | Bering-uClibc 6.x - User Guide | Next |
Contents
Log Files
This chapter explains the location and contents of log files generated on a LEAF Bering-uClibc router, the configuration
in syslog-ng
, maintenance with logrotate
and how to use spacecheck
in lrp.conf
.
In a space constraint and long running environment like LEAF Bering-uClibc, it will be useful to understand how log files, which tends to grow unlimited, are created and maintained.
Note: Remote logging is not described in this chapter.
Location and contents of main log files
The log files are usually written into /var/log
. Some programs writes their log files in subdirectory of /var/log
.
Log files present by default are:
-
auth.log
- This file keeps login information, e.g. thelogin
and the ssh serverdropbear
writes into this file. -
cron.log
- Keeps information of jobs started from cron. -
daemon.log
- The daemon log at/var/log/daemon.log
and contains information about running system and application daemons such ashostapd
daemon, the dns daemondnsmasq
or the MySQL database daemonmysqld
. This can help you trouble-shoot problems with a particular daemon. -
debug
- The debug log provides detailed debug messages from system and applications which log tosyslogd
at the DEBUG level. -
dmesg
- It's a copy of thedmesg
output from the kernel booting, showing the devices it has found and if it has been able to configure them at all (aside from userland configuration).
tbc
Configuration of syslog-ng
tbd
Log file maintenance
The task of log file maintenance is accomplished by /usr/bin/logrotate
.
logrotate
is started daily, weekly and monthly from /etc/cron.daily/multicron-d
, /etc/cron.weekly/multicron-w
and /etc/cron.monthly/multicron-m
.
Log files will be compressed and rotated if a given size (default 1MB) is reached.
It also restarts a daemon after log rotation if needed. The files are rotated up to four generations.
logrotate
keeps the configuration files in /etc/logrotate.d
, usually named after the application generating the log file (e.g /etc/logrotate.d/ulogd
.
For the default log files (syslog
, user.log
, cron.log
, daemon.log
, auth.log
, debug
, wtmp
) the logrotation configuration has been added to /etc/logrotate.d/syslog
.
logrotate options
The following example is the default logrotate.d file /etc/logrotate.d/syslog
for /var/log/syslog
and other common log files created by LEAF Bering-uClibc at boot time.
# add files to be rotated (daily, weekly, monthly) # NOTE: depends if LOGSIZE has been reached LOGS_DAILY="syslog user.log daemon.log cron.log auth.log debug" LOGS_WEEKLY="" LOGS_MONTLY="wtmp" # LOGSIZE - size in kb when logrotate move and compress log files LOGSIZE=1024 # DAEMON - restart this service after logrotation DAEMON=syslog-ng # METHOD - restart command METHOD=restart # USER - set user permission #USER=sh-httpd # GROUP - set group permission #GROUP=adm # if set to one the first iteration will be compressed COMPRESS_ALL=1
Using Spacecheck in lrp.conf
tbd
Prev | Up | Next |