Bug 189597 - klogd always sets console_loglevel
Summary: klogd always sets console_loglevel
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: sysklogd
Version: 3.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Peter Vrabec
QA Contact: Brian Brock
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-04-21 14:50 UTC by Jarett Stevens
Modified: 2007-11-30 22:07 UTC (History)
2 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2007-08-02 12:30:27 UTC


Attachments (Terms of Use)
Universal diff (17.80 KB, text/plain)
2006-04-21 14:50 UTC, Jarett Stevens
no flags Details

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, ...


Note You need to log in before you can comment on or make changes to this bug.