⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 klogd.8

📁 linux下记录系统日志代码以及记录内核日志代码
💻 8
📖 第 1 页 / 共 2 页
字号:
.\" Copyright 1994 Dr. Greg Wettstein, Enjellic Systems Development..\" May be distributed under the GNU General Public License.\" Sun Jul 30 01:35:55 MET: Martin Schulze: Updates.\" Sun Nov 19 23:22:21 MET: Martin Schulze: Updates.\" Mon Aug 19 09:42:08 CDT 1996: Dr. G.W. Wettstein: Updates.\".TH KLOGD 8 "21 August, 1999" "Version 1.4" "Linux System Administration".SH NAMEklogd \- Kernel Log Daemon.LP.SH SYNOPSIS.B klogd.RB [ " \-c ".I n].RB [ " \-d " ].RB [ " \-f ".I fname].RB [ " \-iI " ].RB [ " \-n " ].RB [ " \-o " ].RB [ " \-p " ].RB [ " \-s " ].RB [ " \-k ".I fname].RB [ " \-v " ].RB [ " \-x " ].RB [ " \-2 " ].LP.SH DESCRIPTION.B klogdis a system daemon which intercepts and logs Linux kernelmessages..LP.SH OPTIONS.TP.BI "\-c " nSets the default log level of console messages to \fIn\fR..TP.B "\-d"Enable debugging mode.  This will generate \fBLOTS\fR of output tostderr..TP.BI "\-f " fileLog messages to the specified filename rather than to the syslog facility..TP.BI "\-i \-I"Signal the currently executing klogd daemon.  Both of these switches controlthe loading/reloading of symbol information.  The \-i switch signals thedaemon to reload the kernel module symbols.  The \-I switch signals for areload of both the static kernel symbols and the kernel module symbols..TP.B "\-n"Avoid auto-backgrounding.  This is needed especially if the.B klogdis started and controlled by .BR init (8)..TP.B "-o"Execute in 'one\-shot' mode.  This causes \fBklogd\fP to read and logall the messages that are found in the kernel message buffers.  Aftera single read and log cycle the daemon exits..TP.B "-p"Enable paranoia.  This option controls when klogd loads kernel module symbolinformation.  Setting this switch causes klogd to load the kernel modulesymbol information whenever an Oops string is detected in the kernel messagestream..TP.B "-s"Force \fBklogd\fP to use the system call interface to the kernel messagebuffers..TP.BI "\-k " fileUse the specified file as the source of kernel symbol information..TP.B "\-v"Print version and exit..TP.B "\-x"Omits EIP translation and therefore doesn't read the System.map file..TP.B "\-2"When symbols are expanded, print the line twice.  Once with addressesconverted to symbols, once with the raw text.  This allows externalprograms such as ksymoops do their own processing on the originaldata..LP.SH OVERVIEWThe functionality of klogd has been typically incorporated into otherversions of syslogd but this seems to be a poor place for it.  In themodern Linux kernel a number of kernel messaging issues such assourcing, prioritization and resolution of kernel addresses must beaddressed.  Incorporating kernel logging into a separate processoffers a cleaner separation of services.In Linux there are two potential sources of kernel log information: the .I /procfile system and the syscall (sys_syslog) interface, althoughultimately they are one and the same.  Klogd is designed to choosewhichever source of information is the most appropriate.  It does thisby first checking for the presence of a mounted .I /procfile system.  If this is found the .I /proc/kmsgfile is used as the source of kernel loginformation.  If the proc file system is not mounted .B klogduses asystem call to obtain kernel messages.  The command line switch.RB ( "\-s" )can be used to force klogd to use the system call interface as itsmessaging source.If kernel messages are directed through the .BR syslogd " daemon the " klogddaemon, as of version 1.1, has the ability to properly prioritizekernel messages.  Prioritization of the kernel messages was added to itat approximately version 0.99pl13 of the kernel.  The raw kernel messagesare of the form:.IP\<[0\-7]\>Something said by the kernel..PPThe priority of the kernel message is encoded as a single numericdigit enclosed inside the <> pair.  The definitions of these values isgiven in the kernel include file kernel.h.  When a message is receivedfrom the kernel the klogd daemon reads this priority level and assignsthe appropriate priority level to the syslog message.  If file output(\fB-f\fR) is used the prioritization sequence is left pre\-pended to thekernel message.The.B klogddaemon also allows the ability to alter the presentation ofkernel messages to the system console.  Consequent with theprioritization of kernel messages was the inclusion of defaultmessaging levels for the kernel.  In a stock kernel the the defaultconsole log level is set to 7.  Any messages with a priority levelnumerically lower than 7 (higher priority) appear on the console.Messages of priority level 7 are considered to be 'debug' messages andwill thus not appear on the console.  Many administrators,particularly in a multi\-user environment, prefer that all kernelmessages be handled by klogd and either directed to a file or tothe syslogd daemon.  This prevents 'nuisance' messages such as lineprinter out of paper or disk change detected from cluttering theconsole.When.B \-cis given on the commandline the.B klogddaemon will execute a system call to inhibit all kernel messages frombeing displayed on the console.  Former versions always issued thissystem call and defaulted to all kernel messages except for panics.This is handled differently nowardays so.B klogddoesn't need to set this value anymore.  Theargument given to the \fB\-c\fR switch specifies the priority level ofmessages which will be directed to the console.  Note that messages ofa priority value LOWER than the indicated number will be directed tothe console..IPFor example, to have the kernel display all messages with apriority level of 3.BR "" ( KERN_ERR )or more severe the followingcommand would be executed:.IP.nf	klogd \-c 4.fi.PPThe definitions of the numeric values for kernel messages are given inthe file .IR kernel.h " which can be found in the " /usr/include/linuxdirectory if the kernel sources are installed.  These values parallelthe syslog priority values which are defined in the file .IR syslog.h " found in the " /usr/include/sys " sub\-directory."The klogd daemon can also be used in a 'one\-shot' mode for reading thekernel message buffers.  One shot mode is selected by specifying the\fB\-o\fR switch on the command line.  Output will be directed to either thesyslogd daemon or to an alternate file specified by the \fB-f\fR switch..IPFor example, to read all the kernel messages after a systemboot and record them in a file called krnl.msg the followingcommand would be given..IP.nf	klogd -o -f ./krnl.msg.fi.PP.SH KERNEL ADDRESS RESOLUTIONIf the kernel detects an internal error condition a general protectionfault will be triggered.  As part of the GPF handling procedure thekernel prints out a status report indicating the state of theprocessor at the time of the fault.  Included in this display are thecontents of the microprocessor's registers, the contents of the kernelstack and a tracing of what functions were being executed at the timeof the fault.This information is.B EXTREMELY IMPORTANTin determining what caused the internal error condition.  Thedifficulty comes when a kernel developer attempts to analyze thisinformation.  The raw numeric information present in the protectionfault printout is of very little use to the developers.  This is dueto the fact that kernels are not identical and the addresses ofvariable locations or functions will not be the same in all kernels.In order to correctly diagnose the cause of failure a kernel developerneeds to know what specific kernel functions or variable locationswere involved in the error.As part of the kernel compilation process a listing is created whichspecified the address locations of important variables and function inthe kernel being compiled.  This listing is saved in a file calledSystem.map in the top of the kernel directory source tree.  Using thislisting a kernel developer can determine exactly what the kernel was

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -