[Pacemaker] ocf_log
Steve Kwee
skwee at itw.de
Fri Apr 17 16:34:58 UTC 2009
Steve Kwee <skwee at ...> writes:
>
> Andrew Beekhof <beekhof at ...> writes:
>
> >
> > On Fri, Apr 17, 2009 at 13:28, Steve Kwee <skwee at ...> wrote:
> > >
> > > In my /etc/ha.cf I now have:
> ....
> > Opps - this makes no difference for openais clusters (I missed that
> > part of your original email).
> >
> > find this part of openais.conf and change debug: to "on"
> >
> > logging {
> > debug: off
> > fileline: off
> > to_syslog: yes
> > to_stderr: no
> > syslog_facility: daemon
> > timestamp: on
> > }
> >
> ....
>
Thanks again for your answers
Here is my summary on the subject of
logging in an openAIS / pacemaker stack
1. Logging for heartbeat processes
The logging for openAIS is configured in /etc/ais/openais.conf
example:
logging {
fileline: off
to_syslog: yes
to_stderr: no
syslog_facility: daemon
# debug: on
debug: off
timestamp: on
}
for details see the manpage openais.conf
The debug flag is the default setting for the child processes
(crmd, lrmd, mgmtd etc)
The individual debug level of each daemon can dynamically be changed by
sending the heartbeat process SIGUSR1 and SIGUSR2 signals. SIGUSR1 raises the
debug level, and SIGUSR2 lowers it. A sample debug directive is shown below.
When the heartbeat subprocess dies, it will be recreated by aisexec with
the default setting. So debugging ca be turned on dynamically for individual
child processes even if the setting in openais.conf is "off"
The config file openais.conf is read on startup. There is no known way
to reload it but to restart the openAIS daemon
2. Logging for OCF-ResourceAgents
Loglevels:
debug: off means log LOG_INFO and higher
debug: on means log LOG_DEBUG and higher
The heartbeat ha_logd is not used.
In /etc/ha.d/ha.cf set:
logfacility daemon
# debug 1 only for debugging
debug 0
Question:
I configured a lsb:heartbeat:Stateful dummy resource and did
ocf_log debug "xxx"
ocf_log info "xxx"
in a monitor op every 5s
I can see the ocf_log info in the syslog but the ocf_log debug never appears
I tried all from
debug 1
debug on
debug true
debug yes
I patched /etc/ha.d/shellfuncs to
ha_debug() {
# SKW
echo "`date` skw $HA_debug" >> /var/log/ocf-debug.log
if [ "x${HA_debug}" = "x0" ] ; then
return 0
fi
....
and I found that HA_debug is always "0" whatever I put to ha.cf
What I was searching for was a way to dynamicall change the loglevel
of ocf_log for the OCF-RAs. It seems to me that this should be
implemented in
.ocf-shellfuncs:ocf_log
This is in the package heartbeat-resources so I don't know if this
is the appropriate mailing list.
For myself I found the following solution for .ocf-shellfuncs
# include another settings file
. ${OCF_ROOT}/resource.d/heartbeat/.ocf-settings
...
# prepare OCF_LOGLEVELS, called in __ocf_init_loglevel
__ocf_init_loglevel() {
case "${OCF_LOGLEVEL}" in
crit) OCF_LOGLEVELS="crit";;
err) OCF_LOGLEVELS="crit err";;
warn) OCF_LOGLEVELS="crit err warn";;
info) OCF_LOGLEVELS="crit err warn info";;
debug) OCF_LOGLEVELS="crit err warn info debug";;
*) __OCF_PRIO=`echo ${__OCF_PRIO}| tr '[a-z]' '[A-Z]'`;;
esac
}
...
# new ocf_log with filter depending on OCF_PRI and OCF_LOGLEVEL
ocf_log() {
# TODO: Revisit and implement internally.
if
[ $# -lt 2 ]
then
ocf_log err "Not enough arguments [$#] to ocf_log."
fi
__OCF_PRIO="$1"
shift
__OCF_MSG="$*"
if [[ $OCF_LOGLEVELS == *$__OCF_PRIO* ]]; then
case "${__OCF_PRIO}" in
crit) __OCF_PRIO="CRIT";;
err) __OCF_PRIO="ERROR";;
warn) __OCF_PRIO="WARNING";;
info) __OCF_PRIO="INFO";;
debug)__OCF_PRIO="DEBUG";;
*) __OCF_PRIO=`echo ${__OCF_PRIO}| tr '[a-z]' '[A-Z]'`;;
esac
ha_log "${__OCF_PRIO}: $__OCF_MSG"
fi
}
More information about the Pacemaker
mailing list