Systemmeldungen


Der Syslog Dämon Protokolliert Systemmeldungen unter anderem in Dateien, als Shell Ausgabe oder über den Syslog Dämon zu einem anderen Server. Dabei werden eine Menge an Informationen Protokolliert, wie z.B. Kernelmeldungen, Hardwareinformationen, Nutzer Login-Logouts, Netzwerkoperationen u.v.m.

Dabei können für die Protokollierung unter anderem die Dämonen „syslogd“ zur Protokollierung von Programmen, „klogd“ für Kernelmeldungen, die mit dem Kommando „dmesg“ ausgegeben werden können. Unter anderem gibt es noch die Syslog Dämonen „syslogd-ng“ und den „rsyslogd“. Die Konfigurationsdateien befinden sich nach Dämon in der Datei „/etc/syslog.conf“ oder „/etc/syslog-ng/syslog-ng.conf“.

Unter Linux Systemen werden die Log Dateien im Verzeichnis „/var/log/“ angelegt. Mit dem Programm „logrotate“ wird gesteuert, in welchem Intervall eine neue Logdatei angelegt und die ätere Komprimiert (oder gelöscht) wird. Dieses Programm kann unter „/etc/logrotate.conf“ oder „/etc/logrotate.d/*.*“ konfiguriert werden.






Syntax:

  • /etc/init.d/rsyslog [start|stop|status]




root@home:/etc# /etc/init.d/rsyslog status
rsyslogd is running.




Am Beispiel eines Red Hat Systems, sind dann auszugsweise folgende Log Dateien im Verzeichnis „/var/log/*“.

[root@home ~]# ll /var/log
insgesamt 1388
...
-rw-------. 1 root root  52665 10. Apr 2013  anaconda.xlog
-rw-------. 1 root root 106672 10. Apr 2013  anaconda.yum.log
drwxr-x---. 2 root root   4096 10. Apr 2013  audit
-rw-r--r--. 1 root root   2334 22. Jun 15:57 boot.log
-rw-------. 1 root utmp      0 22. Jun 16:32 btmp
-rw-------. 1 root root   1125 22. Jun 16:40 cron
drwxr-xr-x. 2 lp   sys    4096 28. Feb 2013  cups
-rw-r--r--. 1 root root  21666 22. Jun 15:57 dmesg
-rw-r--r--. 1 root root 146292 22. Jun 16:02 lastlog
-rw-------. 1 root root    544 22. Jun 16:34 maillog
-rw-------. 1 root root    143 22. Jun 16:32 messages
drwx------. 2 root root   4096 24. Nov 2010  ppp
-rw-------. 1 root root      0 22. Jun 16:32 secure
-rw-------. 1 root root      0 22. Jun 16:32 spooler
-rw-rw-r--. 1 root utmp  29568 22. Jun 16:02 wtmp
-rw-r--r--. 1 root root  70630 22. Jun 16:44 Xorg.0.log
-rw-------. 1 root root      0 22. Jun 16:32 yum.log
...




Zu beachten ist, dass nicht alle Programme und Dienste mit den Syslog Dämonen zusammenarbeiten, sondern die Protokollierung selbst vornehmen (z.B. SAMBA, CUPS).




Beispiel Konfigurations Datei /etc/rsyslog.conf:

Anzeigen

Ausblenden

#  /etc/rsyslog.conf    Configuration file for rsyslog.
#
#                       For more information see
#                       /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html


#################
#### MODULES ####
#################

$ModLoad imuxsock # provides support for local system logging
$ModLoad imklog   # provides kernel logging support
#$ModLoad immark  # provides --MARK-- message capability

# provides UDP syslog reception
#$ModLoad imudp
#$UDPServerRun 514

# provides TCP syslog reception
#$ModLoad imtcp
#$InputTCPServerRun 514

###########################
#### GLOBAL DIRECTIVES ####
###########################

#
# Use traditional timestamp format.
# To enable high precision timestamps, comment out the following line.
#
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

#
# Set the default permissions for all log files.
#
$FileOwner root
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022

#
# Where to place spool and state files
#
$WorkDirectory /var/spool/rsyslog

#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf


###############
#### RULES ####
###############

#
# First some standard log files.  Log by facility.
#
auth,authpriv.*                 /var/log/auth.log
*.*;auth,authpriv.none          -/var/log/syslog
#cron.*                         /var/log/cron.log
daemon.*                        -/var/log/daemon.log
kern.*                          -/var/log/kern.log
lpr.*                           -/var/log/lpr.log
mail.*                          -/var/log/mail.log
user.*                          -/var/log/user.log

#
# Logging for the mail system.  Split it up so that
# it is easy to write scripts to parse these files.
#
mail.info                       -/var/log/mail.info
mail.warn                       -/var/log/mail.warn
mail.err                        /var/log/mail.err

#
# Logging for INN news system.
#
news.crit                       /var/log/news/news.crit
news.err                        /var/log/news/news.err
news.notice                     -/var/log/news/news.notice

#
# Some "catch-all" log files.
#
*.=debug;\
        auth,authpriv.none;\
        news.none;mail.none     -/var/log/debug
*.=info;*.=notice;*.=warn;\
        auth,authpriv.none;\
        cron,daemon.none;\
        mail,news.none          -/var/log/messages

#
# Emergencies are sent to everybody logged in.
#
#
*.emerg                         :omusrmsg:*

#
# I like to have messages displayed on the console, but only on a virtual
# console I usually leave idle.
#
#daemon,mail.*;\
#       news.=crit;news.=err;news.=notice;\
#       *.=debug;*.=info;\
#       *.=notice;*.=warn       /dev/tty8

# The named pipe /dev/xconsole is for the `xconsole' utility.  To use it,
# you must invoke `xconsole' with the `-file' option:
# 
#    $ xconsole -file /dev/xconsole [...]
#
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably
#      busy site..
#

daemon.*;mail.*;\
        news.err;\
        *.=debug;*.=info;\
        *.=notice;*.=warn       |/dev/xconsole




FIXME




Das Kommando „dmesg“ zeigt die letzten Kernelmeldungen an.


Syntax:

  • [root@home ~]# dmesg




Beispiel Ausgabe von dmesg

Anzeigen

Ausblenden

[root@home ~]# dmesg
Initializing cgroup subsys cpu
Linux version 2.6.32-358.2.1.el6.i686 (mockbuild@sl6.fnal.gov) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Tue Mar 12 14:17:32 CDT 2013
KERNEL supported cpus:
  Intel GenuineIntel
  AMD AuthenticAMD
  NSC Geode by NSC
  Cyrix CyrixInstead
  Centaur CentaurHauls
  Transmeta GenuineTMx86
  Transmeta TransmetaCPU
  UMC UMC UMC UMC
Disabled fast string operations
BIOS-provided physical RAM map:
 BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
 BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
 BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
 BIOS-e820: 0000000000100000 - 000000003fff0000 (usable)
 BIOS-e820: 000000003fff0000 - 0000000040000000 (ACPI data)
 BIOS-e820: 00000000fffc0000 - 0000000100000000 (reserved)
DMI 2.5 present.
SMBIOS version 2.5 @ 0xFFF30
DMI: innotek GmbH VirtualBox, BIOS VirtualBox 12/01/2006
e820 update range: 0000000000000000 - 0000000000001000 (usable) ==> (reserved)
e820 remove range: 00000000000a0000 - 0000000000100000 (usable)
last_pfn = 0x3fff0 max_arch_pfn = 0x400000
MTRR default type: uncachable
MTRR variable ranges disabled:
x86 PAT enabled: cpu 0, old 0x7040600070406, new 0x7010600070106
CPU MTRRs all blank - virtualized system.
initial memory mapped : 0 - 01000000
init_memory_mapping: 0000000000000000-00000000375fe000
Using x86 segment limits to approximate NX protection
 0000000000 - 0000200000 page 4k
 0000200000 - 0037400000 page 2M
 0037400000 - 00375fe000 page 4k
kernel direct mapping tables up to 375fe000 @ 7000-f000
RAMDISK: 37140000 - 37fef640
Allocated new RAMDISK: 00c79000 - 01b28640
Move RAMDISK from 0000000037140000 - 0000000037fef63f to 00c79000 - 01b2863f
ACPI: RSDP 000e0000 00024 (v02 VBOX  )
ACPI: XSDT 3fff0030 00034 (v01 VBOX   VBOXXSDT 00000001 ASL  00000061)
ACPI: FACP 3fff00f0 000F4 (v04 VBOX   VBOXFACP 00000001 ASL  00000061)
ACPI: DSDT 3fff0410 01A63 (v01 VBOX   VBOXBIOS 00000002 INTL 20100528)
ACPI: FACS 3fff0200 00040
ACPI: SSDT 3fff0240 001CC (v01 VBOX   VBOXCPUT 00000002 INTL 20100528)
137MB HIGHMEM available.
885MB LOWMEM available.
  mapped low ram: 0 - 375fe000
  low ram: 0 - 375fe000
  node 0 low ram: 00000000 - 375fe000
  node 0 bootmap 0000b000 - 00011ec0
(9 early reservations) ==> bootmem [0000000000 - 00375fe000]
  #0 [0000000000 - 0000001000]   BIOS data page ==> [0000000000 - 0000001000]
  #1 [0000001000 - 0000002000]    EX TRAMPOLINE ==> [0000001000 - 0000002000]
  #2 [0000006000 - 0000007000]       TRAMPOLINE ==> [0000006000 - 0000007000]
  #3 [0000400000 - 0000c6f610]    TEXT DATA BSS ==> [0000400000 - 0000c6f610]
  #4 [000009fc00 - 0000100000]    BIOS reserved ==> [000009fc00 - 0000100000]
  #5 [0000c70000 - 0000c78079]              BRK ==> [0000c70000 - 0000c78079]
  #6 [0000007000 - 000000b000]          PGTABLE ==> [0000007000 - 000000b000]
  #7 [0000c79000 - 0001b28640]      NEW RAMDISK ==> [0000c79000 - 0001b28640]
  #8 [000000b000 - 0000012000]          BOOTMAP ==> [000000b000 - 0000012000]
Zone PFN ranges:
  DMA      0x00000001 -> 0x00001000
  Normal   0x00001000 -> 0x000375fe
  HighMem  0x000375fe -> 0x0003fff0
Movable zone start PFN for each node
early_node_map[2] active PFN ranges
    0: 0x00000001 -> 0x0000009f
    0: 0x00000100 -> 0x0003fff0
On node 0 totalpages: 262030
  DMA zone: 32 pages used for memmap
  DMA zone: 0 pages reserved
  DMA zone: 3966 pages, LIFO batch:0
  Normal zone: 1740 pages used for memmap
  Normal zone: 220978 pages, LIFO batch:31
  HighMem zone: 276 pages used for memmap
  HighMem zone: 35038 pages, LIFO batch:7
Using APIC driver default
...





Cloud

  • Zuletzt geändert: 23.07.2017 23:35
  • von Tom