Commit Graph

140 Commits

Author SHA1 Message Date
Christine Caulfield
7b96a937df log: Configure knet logging to the same as corosync
Before this, all knet messages, including debug, were sent
over the pipe from knet to corosync and filtered in corosync.
This was obviously a waste, so now we tell knet the logging
level we need from it and so only get the messages that the
user has requested.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2022-03-31 17:29:20 +02:00
Jan Friesse
60dbacaeb4 logsys: Unlock config mutex on error
Thanks Ryan Cai <ycaibb@gmail.com> for reporting the problem.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2021-09-13 09:13:54 +02:00
Jan Friesse
bd2fff5bb3 logsys: Support hires timestamp
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-10-29 17:45:29 +01:00
Jan Friesse
82f35f1720 log: Implement support for reopening log files
Feature depends on existence of libqb function qb_log_file_reopen.

New function call is added into CFG service API. This function is
used by corosync-cfgtool which now accepts -L parameter.

Finally, logrotate "postrotate" script is calling
corosync-cfgtool -L to notify corosync, instead of using
copytruncate option.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-10-16 14:46:52 +02:00
Jan Friesse
11fa527ed4 logging: Close before and open blackbox after fork
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-01-30 13:21:52 +01:00
Jan Friesse
79dba9c51f logging: Make blackbox configurable
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-01-30 13:21:48 +01:00
Michael Jones
b4c06e52f3 list: Replace uses of list.h with qblist.h
Signed-off-by: Michael Jones <jonesmz@jonesmz.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2016-10-27 14:56:52 +02:00
Jan Friesse
8f13a98320 logsys: Log warning if flightrecorder init fails
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2014-06-02 14:36:10 +02:00
Jan Friesse
1b6abcc7d5 Log: Make reload of logging work
When reload was called multiple times (~20), logging to file stopped
working.

Main problem was hidden in the fact, that log file was opened multiple
times, because even target_id was shared via subsystem loggers, file
name was not.

Solution is to ALWAYS set proper log file name into subsystem logger
(copy is stored). This will not only fix problem but also removes small
leak.

Also if filename didn't changed, function can return sooner.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2014-03-25 15:13:33 +01:00
Jan Friesse
b88c0766fe logsys: Make logging of totem work again
Because of change in libqb (9abb686) logging of TOTEM subsystem stopped
working.

Instead of rely on previous behavior (implicit substring match), all
totem files are now explicitly given.

Also QB subsystem now uses comma separated filelist instead of previous
function calling.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2013-11-04 12:32:35 +01:00
Jan Friesse
56ee492471 Check result of logsys_subsys_create
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2013-06-13 10:53:56 +02:00
Jan Friesse
d5d4cdb972 Check logsys_format_set result in logsys setup
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2013-06-13 10:53:56 +02:00
Jan Friesse
d5d3fb4d45 Do not dereference format_buffer when it's NULL
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2013-06-13 10:53:55 +02:00
Jan Friesse
5717655019 Add support for debug level trace in config file
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-09-19 11:03:10 +02:00
Jan Friesse
7fe307383f Remove newline in logsys_config_file_set_unlocked
Also remove commented leftover.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-09-06 09:39:18 +02:00
Jan Friesse
bd30fe3dcd Make threaded log work
Previous two log releated patches tried to solve few problems with
threaded libqb, but introduced regressions when running in daemon mode.

This patch takes bigger hammer and hopefully solves all problems.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-09-06 09:39:15 +02:00
Jan Friesse
bd138085ca Ensure qb_log thread is started
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-09-05 09:10:57 +02:00
Jan Friesse
dbe0e9e382 Log: Use threaded mode for syslog and file log
Syslog and file log can block, so it's good idea to use libqb threaded
mode to prevent it.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-08-30 09:46:48 +02:00
Angus Salkeld
5831136c87 LOG: make sure the log target is enabled.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-05-29 14:02:42 +10:00
Angus Salkeld
e6b35bdb7a LOG: handle closing unused logfiles better
This fixes a bug where having a second log file will close
the previous one.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-05-29 14:02:42 +10:00
Angus Salkeld
e6afc761fe LOG: be more explict about the qb file names
else we can get messages been put in the wrong subsys.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-05-29 14:02:42 +10:00
Angus Salkeld
41b4416bd4 Remove unused function logsys_priority_name_get()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-03-09 21:54:51 +11:00
Angus Salkeld
f628ccba8b Add pid, hostname and process name to the logfile
Note this is only for file targets not stderr or syslog.

https://bugzilla.redhat.com/show_bug.cgi?id=789925

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-03-09 21:54:51 +11:00
Steven Dake
2ad0cdc832 Update copyright header dates in exec directory
Signed-off-by: Steven Dake <sdake@redhat.com>
Reviewed-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-13 17:05:04 -07:00
Angus Salkeld
8992acb815 LOG: add libqb as a "subsys"
So we can see libqb internal logs

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2012-02-07 10:53:56 +11:00
Jan Friesse
33e5ce8d56 Show correct error when open of logfile failed
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2012-02-02 09:30:49 +01:00
Angus Salkeld
3698b78de9 LOG: make sure that debug works to syslog
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2012-01-25 11:33:09 +11:00
Steven Dake
8ad583a54c Move logsys.c into corosync binary instead of a shared object
Our preferred shared logging system is exported via the libqb library.  As
a result, the corosync project no longer needs to export logsys.so and the
code can be directly included in the binary.  The header file can also be
removed.

Signed-off-by: Steven Dake <sdake@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2012-01-06 18:19:59 -07:00
Angus Salkeld
c317ee433f LOG: Fix a crash in the shutdown.
Reviewed-by: Steven Dake <sdake@redhat.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-13 15:00:42 +11:00
Angus Salkeld
0fc51c40fd LOG: cleanup logging resources at exit
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-11-11 09:05:08 +11:00
Angus Salkeld
2cf37d4063 Set the size of the blackbox to the size on flatiron
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-10-22 17:42:53 +11:00
Angus Salkeld
78a5260c06 LOG: use libqb facility conversion functions
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-10-21 19:34:43 +11:00
Angus Salkeld
0e58141a2f LOG: get logging to file working correctly
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-10-21 19:34:43 +11:00
Angus Salkeld
26a6e26f57 LOG: Fix debugging
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-10-21 19:34:43 +11:00
Angus Salkeld
37e17e7a94 libqb: logging & trace
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-08-09 10:37:16 +10:00
Jan Friesse
8c717c22b2 Remove spinlocks
Spinlocks are now removed, because even spinlock can improve
speed is some special cases, in most cases it makes corosync CPU usage
much more intensive and less responsive then if only mutexes are used.

What we were doing is:
pthread_mutex_lock
pthread_spin_lock
pthread_spin_unlock
pthread_mutex_unlock

what is not safe.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-06-29 12:01:54 +02:00
Jerome Flesch
00434a4f10 Fix usage of strerror_r()/perror()
Signed-off-by: Jerome Flesch <jerome.flesch@netasq.com>
Reviewed-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-28 09:56:58 +02:00
Jan Friesse
d76bb76d1f logsys: _logsys_wthread_create never returns != 0
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-06-03 10:59:17 +02:00
Russell Bryant
a53e402912 logsys.c: Use snprintf() instead of sprintf().
Change a couple of string functions to use the the output length
limiting counterpart.

Signed-off-by: Russell Bryant <russell@russellbryant.net>
2011-05-08 02:42:47 -05:00
Angus Salkeld
0ad2494ae7 Fix some "set but not used" warnings [-Wunused-but-set-variable]
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-03-16 07:13:42 +11:00
Russell Bryant
a609f79f1f Ensure that strings are null terminated after strncpy().
From the strcpy(3) man page, the following warning is given:
  The strncpy() function is similar, except that at most n bytes of src
  are  copied.  Warning: If there is no null byte among the first n bytes
  of src, the string placed in dest will not be null-terminated.

The current corosync code base does not take this warning into account
when using strncpy, potentially resulting in non-null terminated strings.

Signed-off-by: Russell Bryant <russell@russellbryant.net>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-03-07 08:30:03 -06:00
Jan Friesse
c5e8237325 logsys: Properly lock flt data before dump
Data needs to be locked, otherwise resulting fdata file may be
incorrect.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-02-22 10:11:11 +01:00
Jan Friesse
88515e3d20 logsys: Don't leak fd on successful fdata dump
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-02-22 10:09:10 +01:00
Steven Dake
7b832592b0 Fix problem where flight data leaks files in /dev/shm when corosync is
restarted continuously via init scripts.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2964 fd59a12c-fef9-0310-b244-a6a79926bd2f
2010-06-28 22:15:48 +00:00
Steven Dake
402c553dd2 Update logsys to use proper ring buffer on file backed map
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2922 fd59a12c-fef9-0310-b244-a6a79926bd2f
2010-06-09 20:14:50 +00:00
Steven Dake
b8af7c3764 sem_wait can be interrupted by signal. Handle interruption properly.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2920 fd59a12c-fef9-0310-b244-a6a79926bd2f
2010-06-03 22:05:17 +00:00
Steven Dake
c3a6b98bdc The static function 'decode_mode()' is used by the static function
'dump_subsys_config()' which is is turn used by the static function
'dump_full_config()' which is never used.

Are these functions used by someone using some magic? I did not find
any reference and even the flag LOGSYS_DEBUG, which prevents them from
compiling, does not exist at some other point.

If these functions are really not used, please remove them (because at
least one of them has a buffer overflow). Patch against 1.2.3
is attached.

If there is a need for these functions, I'll send a patch to fix
the 'decode_mode()' function.

Kind regards

Andreas Florath

Signed-off-by: Andreas Florath <gnu4u at flonatel dot org>



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2915 fd59a12c-fef9-0310-b244-a6a79926bd2f
2010-05-28 20:39:58 +00:00
Steven Dake
4561c6dcf6 Fix problem where memcpy operation occurs incorrectly to copy schedule
parameter data resulting in priority inversion deadlocks on single cpu systems.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2906 fd59a12c-fef9-0310-b244-a6a79926bd2f
2010-05-26 17:47:39 +00:00
Angus Salkeld
4ff33854ad add __attribute__((noreturn)) to functions that always exit.
we had some __attribute__((__noreturn__))
and some    __attribute__((noreturn))

I made them all: __attribute__((noreturn))



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2853 fd59a12c-fef9-0310-b244-a6a79926bd2f
2010-05-19 04:34:53 +00:00
Angus Salkeld
ad71b66c7b cov (many): make sure all _set() functions return a signed int
in the body it can return -1, and callers check for -1.
but the return type is unsigned int?



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2849 fd59a12c-fef9-0310-b244-a6a79926bd2f
2010-05-18 00:46:08 +00:00