Kernel Logging in HP-UX 11i Version 1.5 Manufacturing Part Number: April 30, 2001 © Copyright 2001 © Hewlett-Packard Company. All rights reserved..
Kernel Logging What is Kernel Logging? 1 Kernel Logging What is Kernel Logging? Kernel Logging is an infrastructure for tracking and logging specified behaviors during HP-UX system operation. It enhances the high availability of the operating system by providing enough kernel trace information to enable a system administrator or other troubleshooter to diagnose the root cause of a system problem without needing to reboot the system or reproduce the problem.
Kernel Logging Instrumenting Kernel Subsystems for Kernel Logging Instrumenting Kernel Subsystems for Kernel Logging Although the KL (Kernel Logging) infrastructure is maintained by the KL team (email: KL_team_NJ@fpk.hp.com), it makes sense that the instrumentation of specific kernel subsystems be accomplished by those who know them best: the subsystem owners. Instrumenting a kernel subsystem for kernel logging comprises the three main tasks listed here. Each task is explained in the sections that follow.
Step 3. If you and the KL team determine that a new subsystem ID must be defined-because there is no pre-existing subsystem ID suitable for your code, or because the pre-existing subsystem IDs are too general (for example, in a huge subsystem like VM, a subsystem ID that further subdivides it might be very useful)--then the following source files must be modified to support the new subsystem ID: • /ux/core/kern/common/sys/subsys_id.
Kernel Logging Instrumenting Kernel Subsystems for Kernel Logging parameter. The kernel developer has assigned the name SETTUNE_EVENT to this event. Thus, the event ID for this kernel event becomes KL_DYNTUNE_SETTUNE_EVENT Step 3. Add your event IDs to your local header file, or to your .c file, and assign each an integer value. It is good practice to keep all #define statements of a particular subsystem in one file, typically in a local header file.
Kernel Logging Instrumenting Kernel Subsystems for Kernel Logging Continuing the example of the Dynamic Tuning subsystem, and assuming that the developer had decided the event is an INFORMATIVE event, and that it is the first event of that class in the subsystem, the entry in the local header file for this event would be as follows: KL_DYNTUNE_SETTUNE_EVENT=5000 Add KL Instrumentation Points to Your Subsystem The three macros listed in the table below are the entry points to the Kernel Logging infrastructur
Kernel Logging Instrumenting Kernel Subsystems for Kernel Logging The data passed to the KL infrastructure can be combined with a user-friendly message describing the event and its implications. These user-friendly messages are composed, stored, and built by you, in a message catalog file. The steps to complete this task are given below. But first, a couple of examples.
Kernel Logging Instrumenting Kernel Subsystems for Kernel Logging The $setn ... line signals the beginning a new set of messages, and only needs to be added if subsystem_ID is a new one. Step 3. Add a new n message line for each new instrumentation point you have introduced.
Kernel Logging Using Kernel Logging Using Kernel Logging Kernel Logging contributes to the high-availability of your system by giving system administrators and other troubleshooters the ability to collect the information necessary to diagnose problems in the HP-UX kernel while the system is still running. The cause of a system problem can often be tracked down without having to try to reproduce the problem or reboot the system.
Kernel Logging Using Kernel Logging You can obtain information, in the form of a report, about the status of the KL infrastructure. A typical report looks similar to this: # kl -i Kernel Logging Information: Kernel Logging: Kernel Logging Disk Writer: Kernel Logging Picture (Snapshot): Current Queue Size: Number of Messages Queued: Log File name: Log File size: Subsystem Name: KL_VM ( 513) KL_PKM ( 514) KL_DLKM ( 515) KL_PM ( 516) KL_VFS ( 517) KL_VXFS ( 518) etc. # Step 1.
Kernel Logging Using Kernel Logging #kl -l level subsystem_ID ... For example, the following command sets level to INFORMATION for the KL_DLKM subsystem: #kl -l i KL_DLKM. That means that messages of classes DISASTER, ERROR, WARNING, and INFORMATIVE, coming from the KL_DLKM subsystem, will now be logged. Classes of messages coming from other subsystems remain unchanged. Complete definitions of level and subsystem_ID are given on the kl(1M) manpage. Step 2.
Kernel Logging Using Kernel Logging This causes all messages in memory to be dumped to filename and removed from memory. Obtaining Human-readable KL Reports The KL logfile is a binary file. Before you can display or print logfile data in human-readable form, it must be formatted by the netfmt command. The formatted data is written to standard output by default, or to filename, if the -f option is specified. Step 1.
Kernel Logging Using Kernel Logging their product or kernel subsystem during installation. However, a system administrator or other users with appropriate privileges can use it to reconfigure the default level of messages that are logged for a given subsystem. Refer to the nettlconf(1M) manpage for complete information on using this command. NOTE It is not recommended that nettlconf be used to change any other aspects of the Kernel Logging infrastructure specified in the /etc/nettlgen.conf file.
Kernel Logging Using Kernel Logging Kernel Logging Manual Pages NAME KL_LOG_INFO(), KL_LOG_STR(), KL_LOG_DATA() – Kernel Logging Macros Synopsis KL_LOG_INFO ( unsigned short evt, short cl, unsigned short ss, unsigned long p0, p1, p2, p3, p4 ); KL_LOG_STR ( unsigned short evt, short cl, unsigned short ss, char *cp ); KL_LOG_DATA ( unsigned short evt, short cl, unsigned short ss, caddr_t dp, int len ); Parameters evt evt is the ID of the event which triggered the instrumentation point to be executed.
Kernel Logging Using Kernel Logging WARNING The WARNING class signals an abnormal event, possibly caused by problems in an individual subsystem INFORMATIVE The INFORMATIVE class signals important routine operations and current system values. ss ss is the ID of the subsystem the instrumentation point belongs to. It will be cast to type unsigned short. p[0-4] p[0-4] are five long integers logged by KL as user-defined data. They will be cast to type long. cp cp is a pointer to a string to be logged.
Kernel Logging Using Kernel Logging subsystem IDs, which is set to be from 513 to 1023 ❏ whether the subsystem specified by the instrumentation point has been authorized (by you) to issue messages of the specified level, i.e., if subsystem X has been specified to log only messages of classes DISASTER and ERROR, then any messages issued by subsystem X with the class WARNING will not be logged.