From Fedora Project Wiki
m (loader now has its own tag)
Line 48: Line 48:
Anaconda supports remote logging handled through the rsyslog daemon running on the installed system. It can be configured to forward its logs through TCP to an arbitrary machine in network that is also running a syslog daemon. This is controlled with the <code>syslog</code> [[Anaconda/Options|command line option]]. ''Do not forget to enable the port you are running your local syslog daemon on in firewall."
Anaconda supports remote logging handled through the rsyslog daemon running on the installed system. It can be configured to forward its logs through TCP to an arbitrary machine in network that is also running a syslog daemon. This is controlled with the <code>syslog</code> [[Anaconda/Options|command line option]]. ''Do not forget to enable the port you are running your local syslog daemon on in firewall."


It's up to you how the remote logging daemon is configured, the following is an example that logs the messages into the same files as they are logged on the installed system:
It's up to you how the remote logging daemon is configured, you can for instance log all incoming messages into one file or sort them into directories according to the IP address of the remote system.
#rsyslog v3 config file
 
The anaconda RPM provides the <code>analog</code> script, which generates a suitable rsyslogd configuration file based on a couple of install parameters. It is also able to generate a bash command to launch rsyslogd with the given configuration. Thus you can do from the shell:
#### MODULES ####
  $ eval `scripts/analog -p 6080 -s -o ./someconf /home/akozumpl/remote_inst`
This causes starts a rsyslog daemon that will listen on port 6080. The logs from the remote machine with IP 10.34.33.221 will be stored in <code>/home/akozumpl/remote_inst/10.34.33.221</code>, e.g. <code>/home/akozumpl/remote_inst/10.34.33.221/anaconda.log</code>.
$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command)
$SystemLogSocketName /home/akozumpl/projects/syslog/socket
# Provides UDP syslog reception
# $ModLoad imudp.so
# $UDPServerRun 6080
# Provides TCP syslog reception
$ModLoad imtcp.so 
$InputTCPServerRun 6080
#### GLOBAL DIRECTIVES ####
# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
# File syncing capability is disabled by default. This feature is usually not required,
# not useful and an extreme performance hit
#$ActionFileEnableSync on
#### RULES ####
$template anaconda_tty4, "%timestamp:8:$:date-rfc3164%,%timestamp:1:3:date-subseconds% %syslogseverity-text:::uppercase% %programname%:%msg%\n"
  $template anaconda_debug, "%syslogfacility-text%|%hostname%|%syslogseverity-text%|%syslogtag%|%msg%\n"
$template anaconda_syslog, "%timestamp:8:$:date-rfc3164%,%timestamp:1:3:date-subseconds% %syslogseverity-text:::uppercase% %programname%:%msg%\n"
*.*                                                  /home/akozumpl/projects/syslog/out_all_debug.log;anaconda_debug
kern.*;\
daemon.*                                            /home/akozumpl/projects/syslog/syslog;anaconda_syslog
:programname, contains, "loader"                    /home/akozumpl/projects/syslog/anaconda.log;anaconda_syslog
:programname, contains, "anaconda"                  /home/akozumpl/projects/syslog/anaconda.log;anaconda_syslog
:programname, contains, "program"                    /home/akozumpl/projects/syslog/program.log;anaconda_syslog
  :programname, contains, "storage"                    /home/akozumpl/projects/syslog/storage.log;anaconda_syslog
:hostname, contains, "sysimage"                      /home/akozumpl/projects/syslog/install.log.syslog;anaconda_syslog
# discard those that we logged
:programname, contains, "rsyslogd"                  ~
:programname, contains, "loader"                    ~
:programname, contains, "anaconda"                  ~
:programname, contains, "program"                    ~
:programname, contains, "storage"                    ~
:hostname, contains, "sysimage"                      ~
kern.*                                              ~
daemon.*                                            ~
# dump the rest
*.*                                                  /home/akozumpl/projects/syslog/unknown_source.log;anaconda_debug


The remote syslog configuration exploits several log message characteristics to be able to sort them into the correct files:
The remote syslog configuration exploits several log message characteristics to be able to sort them into the correct files:
* the IP of the message sender to know which machine generated the message and thud what directory does the message belong to.
* <code>anaconda.log, storage.log</code> and <code>program.log</code> have the name embedded in them as <code>programname</code>.
* <code>anaconda.log, storage.log</code> and <code>program.log</code> have the name embedded in them as <code>programname</code>.
* <code>syslog/code> messages are coming in from kernel and daemon facilities, just like they do on the installed system
* <code>syslog/code> messages are coming in from kernel and daemon facilities, just like they do on the installed system
* <code>install.log.syslog</code> made during package installation is logged as a special <code>sysimage</code> hostname.
* <code>install.log.syslog</code> made during package installation is logged as a special <code>sysimage</code> hostname.


The sample configuration uses the same message format for remote logging as anaconda does, but note that the remote host can specify its own.
Run <code>analog</code> without the <code>-o</code> option to see how exactly does a fitting configuration file look like. Also notice that it uses the same message format for remote logging as anaconda does, but you can of course modify this to specify any format you want.


== To do ==
== To do ==
The current list of logging requirements and tasks is maintained in bugzilla [https://bugzilla.redhat.com/show_bug.cgi?id=524980 524980].
The current list of logging requirements and tasks is maintained in bugzilla [https://bugzilla.redhat.com/show_bug.cgi?id=524980 524980].

Revision as of 10:58, 8 March 2010

Introduction

Anaconda tracks all of its activities in logs. This includes:

  • changing installation steps (that roughly correspond to different screens in the graphical installer)
  • storage devices detection and manipulation
  • installation media detection
  • network initialization
  • kernel messages
  • calls to critical methods within anaconda
  • calls to external programs

Logging on the installed system

During the installation the logs are stored in the /tmp directory:

  • /tmp/anaconda.log, the general installation information, particularly the step changes.
  • /tmp/storage.log, storage devices scan and manipulation (hard drives, partitions, LVM, RAID), partitioning
  • /tmp/program.log, calls to external programs, their output
  • /tmp/syslog, messages from kernel and external programs (Network Manager)
  • /tmp/yum.log, yum's internal log

Certain log messages are also written to the terminals.

  • /dev/tty3, messages from anaconda.log, storage.log and yum.log.
  • /dev/tty4, same as syslog
  • /dev/tty5, stdout and stderr from external programs

tty3 and tty4 reflect certain log files. Log files always contain messages from all the loglevels, including debug, but the minimal loglevel on the terminals can be controlled with the loglevel command line option.

There are two other log files created on the target filesystem, in the /root directory, also accessible at /mnt/sysimage/root during the installation:

  • /mnt/sysimage/root/install.log, log of the package installation process.
  • /mnt/sysimage/root/install.log.syslog, messages from installation chroot logged through the system's syslog. Mostly information about users and groups created during yum's package installation.

Log format

In files the format of the log messages is as follows:

H:M:S,ms LOGLEVEL facility:message

where:

  • H:M:S is the message timestamp
  • ms is the millisecond part of timestamp. Note that this will usually become zero on a remote syslog.
  • LOGLEVEL is the message loglevel. In theory, because kernel messages are part of anaconda logs, all loglevels that are defined in rsyslog can appear in the logfiles. Anaconda itself will however log only at the following loglevels:
    1. DEBUG
    2. INFO
    3. WARN
    4. ERR
    5. CRITICAL
  • facility is the program or component that created the message. Could be for instance kernel, anaconda, storage or similar.
  • message is the log message itself.

For the logs running in terminals, the format simply is:

LOGLEVEL facility:message

Remote logging

Anaconda supports remote logging handled through the rsyslog daemon running on the installed system. It can be configured to forward its logs through TCP to an arbitrary machine in network that is also running a syslog daemon. This is controlled with the syslog command line option. Do not forget to enable the port you are running your local syslog daemon on in firewall."

It's up to you how the remote logging daemon is configured, you can for instance log all incoming messages into one file or sort them into directories according to the IP address of the remote system.

The anaconda RPM provides the analog script, which generates a suitable rsyslogd configuration file based on a couple of install parameters. It is also able to generate a bash command to launch rsyslogd with the given configuration. Thus you can do from the shell:

$ eval scripts/analog -p 6080 -s -o ./someconf /home/akozumpl/remote_inst

This causes starts a rsyslog daemon that will listen on port 6080. The logs from the remote machine with IP 10.34.33.221 will be stored in /home/akozumpl/remote_inst/10.34.33.221, e.g. /home/akozumpl/remote_inst/10.34.33.221/anaconda.log.

The remote syslog configuration exploits several log message characteristics to be able to sort them into the correct files:

  • the IP of the message sender to know which machine generated the message and thud what directory does the message belong to.
  • anaconda.log, storage.log and program.log have the name embedded in them as programname.
  • syslog/code> messages are coming in from kernel and daemon facilities, just like they do on the installed system
  • install.log.syslog made during package installation is logged as a special sysimage hostname.

Run analog without the -o option to see how exactly does a fitting configuration file look like. Also notice that it uses the same message format for remote logging as anaconda does, but you can of course modify this to specify any format you want.

To do

The current list of logging requirements and tasks is maintained in bugzilla 524980.