[ClusterLabs] Antw: [EXT] Re: Configuring millisecond timestamps in pacemaker.log.

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Tue Jan 12 02:42:15 EST 2021


>>> Ken Gaillot <kgaillot at redhat.com> schrieb am 11.01.2021 um 21:16 in
Nachricht
<cca457ea7a3885c044ba4ead8fd43b4eb2c8ee15.camel at redhat.com>:
> Pacemaker doesn't currently support it, sorry. It should be pretty easy
> to add though (when built with libqb 2), so hopefully we can get it in
> 2.1.0.

Some time ago I wrote my own set of logging routines, and actually I uses
nanoseconds (as muc as I could get) as timestamp. Just to shorten output, I
just truncate the extra digits off.
The (somewhat paranoid) code looks like this:

                        if ( (Log.format & LTF_FRAC_MASK) != 0 )
                        {
                                ssize_t nsz = 10;

                                rval = snprintf(fp + 1, nsz, "%09ld",
                                                ts.tv_nsec);
                                assert(rval < nsz);
                        }
                        switch ( Log.format & LTF_FRAC_MASK )
                        {
                        case LTF_FRAC_LONG:
                                fp[7] = '\0';           /* .hhtuuu */
                                break;
                        case LTF_FRAC_MEDIUM:
                                fp[4] = '\0';           /* .hht */
                                break;
                        case LTF_FRAC_SHORT:
                                fp[3] = '\0';           /* .hh */
                                break;
                        default:
                                fp[0] = '\0';   /* '\0' */
                        }

> 
> Of course Pacemaker has always supported logging via syslog, and syslog
> can be configured to use high‑res timestamps, so that's a workaround.
> 
> Does anyone have a strong opinion regarding using high‑res timestamps
> in the Pacemaker detail log whenever supported, vs adding a new
> sysconfig option for it? I feel like we have a ridiculous number of
> options already, and the detail log is expected to be verbose.

Yes options may be a problem. For the routines above I offered these options
(that may be an overkill):

              D      Selects the date component.  The possible formats are (Y
is year, M is month, D is day):

                     L      Long format: YYYYMMDD

                     M      Medium format: YYMMDD

                     S      Short format: MMDD

                     N      None

              T      Selects the time component.  The possible formats are (H
is hour, M is minute, S is second):

                     L      Long format: HHMMSS

                     M      Medium format: MMSS

                     S      Short format: SS

                     N      None

              F      Selects the fractional seconds component.  The possible
formats are (h are hundreds, t are thousands, u are microseconds):

                     L      Long format: .hhtuuu

                     M      Medium format: .hht

                     S      Short format: .hh

                     N      None

Regards,
Ulrich

> 
> On Mon, 2021‑01‑11 at 19:12 +0000, Gerry R Sommerville wrote:
>> Hello,
>> 
>> I am wondering if it is possible to configure high resolution
>> timestamps (including milliseconds) in the pacemaker.log? I was able
>> to get hi‑res timestamps in the corosync.log by adding 'timestamp:
>> hires' under the logging directive in corosync.conf. I was hoping
>> Pacemaker has something similar but I don't see anything in
>> '/etc/sysconfig/pacemaker' or the Pacemaker documentation regarding
>> hi‑res timestamps.
>>  
>> Gerry Sommerville
>> Db2 Development, pureScale Domain
>> E‑mail: gerry at ca.ibm.com 
> ‑‑ 
> Ken Gaillot <kgaillot at redhat.com>
> 
> _______________________________________________
> Manage your subscription:
> https://lists.clusterlabs.org/mailman/listinfo/users 
> 
> ClusterLabs home: https://www.clusterlabs.org/ 





More information about the Users mailing list