Bug 189597

Summary: klogd always sets console_loglevel
Product: Red Hat Enterprise Linux 3 Reporter: Jarett Stevens <jarett.stevens>
Component: sysklogdAssignee: Peter Vrabec <pvrabec>
Status: CLOSED NEXTRELEASE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: sgrubb, tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-08-02 12:30:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Universal diff none

Description Jarett Stevens 2006-04-21 14:50:28 UTC
Description of problem:
klogd does not respect the existing value for console_loglevel (this is the
first number displayed with "sysctl kernel.printk" or if you cat
/proc/sys/kernel/printk).  

Version-Release number of selected component (if applicable):
sysklogd-1.4.1rh (from sysklogd-1.4.1-26_EL3.src.rpm)

How reproducible:
Always

Steps to Reproduce:
1. Modify kernel.printk in /etc/sysctl.conf ; ex: "kernel.printk = 4 4 1 7"
2. Reboot
3. Check the value of kernel.printk after logging in, "sysctl kernel.printk"
  
Actual results:
Unless modified with the "-c" option to klogd, which would be defined in
/etc/sysconfig/syslog, the value of kernel.printk is "6 4 1 7"

Expected results:
The value of kernel.printk should be what was set in /etc/sysctl.conf, "4 4 1 7"

Additional info:
(from Red Hat support ticket 871670)

By default, klogd resets the default console output level to "6" (this is the
first number of the parameter).  This can be changed to any value by modifying
the option line in /etc/sysconfig/syslog; ex:
KLOGD_OPTIONS="-x -c 4" 

The problem lies in the source; the SRPM is sysklogd-1.4.1-26_EL3.src.rpm
 
After extracting /usr/src/redhat/SOURCES/sysklogd-1.4.1rh.tar.gz you can see the
problem in /sysklogd-1.4.1rh/klogd.c
 
If you don't explicitly set the default log level with the "-c" option (lines
1005-1007, 1045-1057), then it remains at a staticly-set value of "6" (line 298)
when actually set (lines 515-517)
 
 
298                 console_log_level = 6;
...
 
515         /* Set level of kernel console messaging.. */
516         if ( (ksyslog(8, NULL, console_log_level) < 0) && \
517              (errno == EINVAL) )
...
 
1005                     case 'c':           /* Set console message level. */
1006                         log_level = optarg;
1007                         break;
...
 
1045         /* Set console logging level. */
1046         if ( log_level != (char *) 0 )
1047         {
1048                 if ( (strlen(log_level) > 1) || \
1049                      (strchr("12345678", *log_level) == (char *) 0) )
1050                 {
1051                         fprintf(stderr, "klogd: Invalid console logging "
1052                                 "level <%s> specified.\n", log_level);
1053                         return(1);
1054                 }
1055                 console_log_level = *log_level - '0';
1056         }
1057 

A quick search on Google and a review of the changelog for sysklogd indicates
that Red Hat is not actually using the 1.4.1 version (for RH named 1.4.1rh), or
at least not the one from the project site where this is already corrected.
 
http://www.infodrom.org/projects/sysklogd/
 
I have also attached a universal diff.

Comment 1 Jarett Stevens 2006-04-21 14:50:28 UTC
Created attachment 128088 [details]
Universal diff

Comment 4 Peter Vrabec 2007-08-02 12:30:27 UTC
fixed in RHEL4,5, ...