corosync  2.4.6
logconfig.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2005 MontaVista Software, Inc.
3  * Copyright (c) 2006-2011 Red Hat, Inc.
4  *
5  * All rights reserved.
6  *
7  * Author: Steven Dake (sdake@redhat.com)
8  * Jan Friesse (jfriesse@redhat.com)
9  *
10  * This software licensed under BSD license, the text of which follows:
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions are met:
14  *
15  * - Redistributions of source code must retain the above copyright notice,
16  * this list of conditions and the following disclaimer.
17  * - Redistributions in binary form must reproduce the above copyright notice,
18  * this list of conditions and the following disclaimer in the documentation
19  * and/or other materials provided with the distribution.
20  * - Neither the name of the MontaVista Software, Inc. nor the names of its
21  * contributors may be used to endorse or promote products derived from this
22  * software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
34  * THE POSSIBILITY OF SUCH DAMAGE.
35  */
36 
37 #include "config.h"
38 
39 #include <corosync/totem/totem.h>
40 #include <corosync/logsys.h>
41 #ifdef LOGCONFIG_USE_ICMAP
42 #include <corosync/icmap.h>
43 #define MAP_KEYNAME_MAXLEN ICMAP_KEYNAME_MAXLEN
44 #define map_get_string(key_name, value) icmap_get_string(key_name, value)
45 #else
46 #include <corosync/cmap.h>
48 static const char *main_logfile;
49 #define MAP_KEYNAME_MAXLEN CMAP_KEYNAME_MAXLEN
50 #define map_get_string(key_name, value) cmap_get_string(cmap_handle, key_name, value)
51 #endif
52 
53 #include "util.h"
54 #include "logconfig.h"
55 
56 static char error_string_response[512];
57 
79 static int insert_into_buffer(
80  char *target_buffer,
81  size_t bufferlen,
82  const char *entry,
83  const char *after)
84 {
85  const char *current_format = NULL;
86 
87  current_format = logsys_format_get();
88 
89  /* if the entry is already in the format we don't add it again */
90  if (strstr(current_format, entry) != NULL) {
91  return -1;
92  }
93 
94  /* if there is no "after", simply prepend the requested entry
95  * otherwise go for beautiful string manipulation.... </sarcasm> */
96  if (!after) {
97  if (snprintf(target_buffer, bufferlen - 1, "%s%s",
98  entry,
99  current_format) >= bufferlen - 1) {
100  return -1;
101  }
102  } else {
103  const char *afterpos;
104  size_t afterlen;
105  size_t templen;
106 
107  /* check if after is contained in the format
108  * and afterlen has a meaning or return an error */
109  afterpos = strstr(current_format, after);
110  afterlen = strlen(after);
111  if ((!afterpos) || (!afterlen)) {
112  return -1;
113  }
114 
115  templen = afterpos - current_format + afterlen;
116  if (snprintf(target_buffer, templen + 1, "%s", current_format)
117  >= bufferlen - 1) {
118  return -1;
119  }
120  if (snprintf(target_buffer + templen, bufferlen - ( templen + 1 ),
121  "%s%s", entry, current_format + templen)
122  >= bufferlen - ( templen + 1 )) {
123  return -1;
124  }
125  }
126  return 0;
127 }
128 
129 /*
130  * format set is global specific option that
131  * doesn't apply at system/subsystem level.
132  */
133 static int corosync_main_config_format_set (
134  const char **error_string)
135 {
136  const char *error_reason;
137  char new_format_buffer[PATH_MAX];
138  char *value = NULL;
139  int err = 0;
140 
141  if (map_get_string("logging.fileline", &value) == CS_OK) {
142  if (strcmp (value, "on") == 0) {
143  if (!insert_into_buffer(new_format_buffer,
144  sizeof(new_format_buffer),
145  " %f:%l", "g]")) {
146  err = logsys_format_set(new_format_buffer);
147  } else
148  if (!insert_into_buffer(new_format_buffer,
149  sizeof(new_format_buffer),
150  "%f:%l", NULL)) {
151  err = logsys_format_set(new_format_buffer);
152  }
153  } else
154  if (strcmp (value, "off") == 0) {
155  /* nothing to do here */
156  } else {
157  error_reason = "unknown value for fileline";
158  free(value);
159  goto parse_error;
160  }
161 
162  free(value);
163  }
164 
165  if (err) {
166  error_reason = "not enough memory to set logging format buffer";
167  goto parse_error;
168  }
169 
170  if (map_get_string("logging.function_name", &value) == CS_OK) {
171  if (strcmp (value, "on") == 0) {
172  if (!insert_into_buffer(new_format_buffer,
173  sizeof(new_format_buffer),
174  "%n:", "f:")) {
175  err = logsys_format_set(new_format_buffer);
176  } else
177  if (!insert_into_buffer(new_format_buffer,
178  sizeof(new_format_buffer),
179  " %n", "g]")) {
180  err = logsys_format_set(new_format_buffer);
181  }
182  } else
183  if (strcmp (value, "off") == 0) {
184  /* nothing to do here */
185  } else {
186  error_reason = "unknown value for function_name";
187  free(value);
188  goto parse_error;
189  }
190 
191  free(value);
192  }
193 
194  if (err) {
195  error_reason = "not enough memory to set logging format buffer";
196  goto parse_error;
197  }
198 
199  if (map_get_string("logging.timestamp", &value) == CS_OK) {
200  if (strcmp (value, "on") == 0) {
201  if(!insert_into_buffer(new_format_buffer,
202  sizeof(new_format_buffer),
203  "%t ", NULL)) {
204  err = logsys_format_set(new_format_buffer);
205  }
206  } else
207  if (strcmp (value, "off") == 0) {
208  /* nothing to do here */
209  } else {
210  error_reason = "unknown value for timestamp";
211  free(value);
212  goto parse_error;
213  }
214 
215  free(value);
216  }
217 
218  if (err) {
219  error_reason = "not enough memory to set logging format buffer";
220  goto parse_error;
221  }
222 
223  return (0);
224 
225 parse_error:
226  *error_string = error_reason;
227 
228  return (-1);
229 }
230 
231 /*
232  * blackbox is another global specific option that
233  * doesn't apply at system/subsystem level.
234  */
235 static int corosync_main_config_blackbox_set (
236  const char **error_string)
237 {
238  const char *error_reason;
239  char *value = NULL;
240 
241  if (map_get_string("logging.blackbox", &value) == CS_OK) {
242  if (strcmp (value, "on") == 0) {
243  (void)logsys_blackbox_set(QB_TRUE);
244  } else if (strcmp (value, "off") == 0) {
245  (void)logsys_blackbox_set(QB_FALSE);
246  } else {
247  error_reason = "unknown value for blackbox";
248  free(value);
249  goto parse_error;
250  }
251 
252  free(value);
253  } else {
254  (void)logsys_blackbox_set(QB_TRUE);
255  }
256 
257  return (0);
258 
259 parse_error:
260  *error_string = error_reason;
261 
262  return (-1);
263 }
264 
265 static int corosync_main_config_log_destination_set (
266  const char *path,
267  const char *key,
268  const char *subsys,
269  const char **error_string,
270  unsigned int mode_mask,
271  char deprecated,
272  char default_value,
273  const char *replacement)
274 {
275  static char formatted_error_reason[128];
276  char *value = NULL;
277  unsigned int mode;
278  char key_name[MAP_KEYNAME_MAXLEN];
279 
280  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, key);
281  if (map_get_string(key_name, &value) == CS_OK) {
282  if (deprecated) {
284  "Warning: the %s config parameter has been obsoleted."
285  " See corosync.conf man page %s directive.",
286  key, replacement);
287  }
288 
289  mode = logsys_config_mode_get (subsys);
290 
291  if (strcmp (value, "yes") == 0 || strcmp (value, "on") == 0) {
292  mode |= mode_mask;
293  if (logsys_config_mode_set(subsys, mode) < 0) {
294  sprintf (formatted_error_reason, "unable to set mode %s", key);
295  goto parse_error;
296  }
297  } else
298  if (strcmp (value, "no") == 0 || strcmp (value, "off") == 0) {
299  mode &= ~mode_mask;
300  if (logsys_config_mode_set(subsys, mode) < 0) {
301  sprintf (formatted_error_reason, "unable to unset mode %s", key);
302  goto parse_error;
303  }
304  } else {
305  sprintf (formatted_error_reason, "unknown value for %s", key);
306  goto parse_error;
307  }
308  }
309  /* Set to default if we are the top-level logger */
310  else if (!subsys && !deprecated) {
311 
312  mode = logsys_config_mode_get (subsys);
313  if (default_value) {
314  mode |= mode_mask;
315  }
316  else {
317  mode &= ~mode_mask;
318  }
319  if (logsys_config_mode_set(subsys, mode) < 0) {
320  sprintf (formatted_error_reason, "unable to change mode %s", key);
321  goto parse_error;
322  }
323  }
324 
325  free(value);
326  return (0);
327 
328 parse_error:
329  *error_string = formatted_error_reason;
330  free(value);
331  return (-1);
332 }
333 
334 static int corosync_main_config_set (
335  const char *path,
336  const char *subsys,
337  const char **error_string)
338 {
339  const char *error_reason = error_string_response;
340  char *value = NULL;
341  int mode;
342  char key_name[MAP_KEYNAME_MAXLEN];
343 
344  /*
345  * this bit abuses the internal logsys exported API
346  * to guarantee that all configured subsystems are
347  * initialized too.
348  *
349  * using this approach avoids some headaches caused
350  * by IPC and TOTEM that have a special logging
351  * handling requirements
352  */
353  if (subsys != NULL) {
354  if (_logsys_subsys_create(subsys, NULL) < 0) {
355  error_reason = "unable to create new logging subsystem";
356  goto parse_error;
357  }
358  }
359 
360  mode = logsys_config_mode_get(subsys);
361  if (mode < 0) {
362  error_reason = "unable to get mode";
363  goto parse_error;
364  }
365 
366  if (corosync_main_config_log_destination_set (path, "to_stderr", subsys, &error_reason,
367  LOGSYS_MODE_OUTPUT_STDERR, 0, 1, NULL) != 0)
368  goto parse_error;
369 
370  if (corosync_main_config_log_destination_set (path, "to_syslog", subsys, &error_reason,
371  LOGSYS_MODE_OUTPUT_SYSLOG, 0, 1, NULL) != 0)
372  goto parse_error;
373 
374  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_facility");
375  if (map_get_string(key_name, &value) == CS_OK) {
376  int syslog_facility;
377 
378  syslog_facility = qb_log_facility2int(value);
379  if (syslog_facility < 0) {
380  error_reason = "unknown syslog facility specified";
381  goto parse_error;
382  }
384  syslog_facility) < 0) {
385  error_reason = "unable to set syslog facility";
386  goto parse_error;
387  }
388 
389  free(value);
390  }
391  else {
392  /* Set default here in case of a reload */
394  qb_log_facility2int("daemon")) < 0) {
395  error_reason = "unable to set syslog facility";
396  goto parse_error;
397  }
398  }
399 
400  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_level");
401  if (map_get_string(key_name, &value) == CS_OK) {
402  int syslog_priority;
403 
405  "Warning: the syslog_level config parameter has been obsoleted."
406  " See corosync.conf man page syslog_priority directive.");
407 
408  syslog_priority = logsys_priority_id_get(value);
409  free(value);
410 
411  if (syslog_priority < 0) {
412  error_reason = "unknown syslog level specified";
413  goto parse_error;
414  }
416  syslog_priority) < 0) {
417  error_reason = "unable to set syslog level";
418  goto parse_error;
419  }
420  }
421 
422  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_priority");
423  if (map_get_string(key_name, &value) == CS_OK) {
424  int syslog_priority;
425 
426  syslog_priority = logsys_priority_id_get(value);
427  free(value);
428  if (syslog_priority < 0) {
429  error_reason = "unknown syslog priority specified";
430  goto parse_error;
431  }
433  syslog_priority) < 0) {
434  error_reason = "unable to set syslog priority";
435  goto parse_error;
436  }
437  }
438  else if(strcmp(key_name, "logging.syslog_priority") == 0){
440  logsys_priority_id_get("info")) < 0) {
441  error_reason = "unable to set syslog level";
442  goto parse_error;
443  }
444  }
445 
446 #ifdef LOGCONFIG_USE_ICMAP
447  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "logfile");
448  if (map_get_string(key_name, &value) == CS_OK) {
449  if (logsys_config_file_set (subsys, &error_reason, value) < 0) {
450  goto parse_error;
451  }
452  free(value);
453  }
454 #else
455  if (!subsys) {
456  if (logsys_config_file_set (subsys, &error_reason, main_logfile) < 0) {
457  goto parse_error;
458  }
459  }
460 #endif
461 
462  if (corosync_main_config_log_destination_set (path, "to_file", subsys, &error_reason,
463  LOGSYS_MODE_OUTPUT_FILE, 1, 0, "to_logfile") != 0)
464  goto parse_error;
465 
466  if (corosync_main_config_log_destination_set (path, "to_logfile", subsys, &error_reason,
467  LOGSYS_MODE_OUTPUT_FILE, 0, 0, NULL) != 0)
468  goto parse_error;
469 
470  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "logfile_priority");
471  if (map_get_string(key_name, &value) == CS_OK) {
472  int logfile_priority;
473 
474  logfile_priority = logsys_priority_id_get(value);
475  free(value);
476  if (logfile_priority < 0) {
477  error_reason = "unknown logfile priority specified";
478  goto parse_error;
479  }
481  logfile_priority) < 0) {
482  error_reason = "unable to set logfile priority";
483  goto parse_error;
484  }
485  }
486  else if(strcmp(key_name,"logging.logfile_priority") == 0){
488  logsys_priority_id_get("info")) < 0) {
489  error_reason = "unable to set syslog level";
490  goto parse_error;
491  }
492  }
493 
494  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "debug");
495  if (map_get_string(key_name, &value) == CS_OK) {
496  if (strcmp (value, "trace") == 0) {
497  if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_TRACE) < 0) {
498  error_reason = "unable to set debug trace";
499  free(value);
500  goto parse_error;
501  }
502  } else
503  if (strcmp (value, "on") == 0) {
504  if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_ON) < 0) {
505  error_reason = "unable to set debug on";
506  free(value);
507  goto parse_error;
508  }
509  } else
510  if (strcmp (value, "off") == 0) {
511  if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_OFF) < 0) {
512  error_reason = "unable to set debug off";
513  free(value);
514  goto parse_error;
515  }
516  } else {
517  error_reason = "unknown value for debug";
518  free(value);
519  goto parse_error;
520  }
521  free(value);
522  }
523  else {
524  if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_OFF) < 0) {
525  error_reason = "unable to set debug off";
526  goto parse_error;
527  }
528  }
529 
530  return (0);
531 
532 parse_error:
533  *error_string = error_reason;
534 
535  return (-1);
536 }
537 
538 static int corosync_main_config_read_logging (
539  const char **error_string)
540 {
541  const char *error_reason;
542 #ifdef LOGCONFIG_USE_ICMAP
543  icmap_iter_t iter;
544  const char *key_name;
545 #else
546  cmap_iter_handle_t iter;
547  char key_name[CMAP_KEYNAME_MAXLEN];
548 #endif
549  char key_subsys[MAP_KEYNAME_MAXLEN];
550  char key_item[MAP_KEYNAME_MAXLEN];
551  int res;
552 
553  /* format set is supported only for toplevel */
554  if (corosync_main_config_format_set(&error_reason) < 0) {
555  goto parse_error;
556  }
557 
558  if (corosync_main_config_blackbox_set(&error_reason) < 0) {
559  goto parse_error;
560  }
561 
562  if (corosync_main_config_set ("logging", NULL, &error_reason) < 0) {
563  goto parse_error;
564  }
565 
566  /*
567  * we will need 2 of these to compensate for new logging
568  * config format
569  */
570 #ifdef LOGCONFIG_USE_ICMAP
571  iter = icmap_iter_init("logging.logger_subsys.");
572  while ((key_name = icmap_iter_next(iter, NULL, NULL)) != NULL) {
573 #else
574  cmap_iter_init(cmap_handle, "logging.logger_subsys.", &iter);
575  while ((cmap_iter_next(cmap_handle, iter, key_name, NULL, NULL)) == CS_OK) {
576 #endif
577  res = sscanf(key_name, "logging.logger_subsys.%[^.].%s", key_subsys, key_item);
578 
579  if (res != 2) {
580  continue ;
581  }
582 
583  if (strcmp(key_item, "subsys") != 0) {
584  continue ;
585  }
586 
587  snprintf(key_item, MAP_KEYNAME_MAXLEN, "logging.logger_subsys.%s", key_subsys);
588 
589  if (corosync_main_config_set(key_item, key_subsys, &error_reason) < 0) {
590  goto parse_error;
591  }
592  }
593 #ifdef LOGCONFIG_USE_ICMAP
594  icmap_iter_finalize(iter);
595 #else
597 #endif
598 
600  return 0;
601 
602 parse_error:
603  *error_string = error_reason;
604 
605  return (-1);
606 }
607 
608 #ifdef LOGCONFIG_USE_ICMAP
609 static void main_logging_notify(
610  int32_t event,
611  const char *key_name,
612  struct icmap_notify_value new_val,
613  struct icmap_notify_value old_val,
614  void *user_data)
615 #else
616 static void main_logging_notify(
617  cmap_handle_t cmap_handle_unused,
618  cmap_handle_t cmap_track_handle_unused,
619  int32_t event,
620  const char *key_name,
621  struct cmap_notify_value new_val,
622  struct cmap_notify_value old_val,
623  void *user_data)
624 #endif
625 {
626  const char *error_string;
627  static int reload_in_progress = 0;
628 
629  /* If a full reload happens then suspend updates for individual keys until
630  * it's all completed
631  */
632  if (strcmp(key_name, "config.reload_in_progress") == 0) {
633  if (*(uint8_t *)new_val.data == 1) {
634  reload_in_progress = 1;
635  } else {
636  reload_in_progress = 0;
637  }
638  }
639  if (reload_in_progress) {
640  log_printf(LOGSYS_LEVEL_DEBUG, "Ignoring key change, reload in progress. %s\n", key_name);
641  return;
642  }
643 
644  /*
645  * Reload the logsys configuration
646  */
647  if (logsys_format_set(NULL) == -1) {
648  fprintf (stderr, "Unable to setup logging format.\n");
649  }
650  corosync_main_config_read_logging(&error_string);
651 }
652 
653 #ifdef LOGCONFIG_USE_ICMAP
654 static void add_logsys_config_notification(void)
655 {
656  icmap_track_t icmap_track = NULL;
657 
658  icmap_track_add("logging.",
660  main_logging_notify,
661  NULL,
662  &icmap_track);
663 
664  icmap_track_add("config.reload_in_progress",
666  main_logging_notify,
667  NULL,
668  &icmap_track);
669 }
670 #else
671 static void add_logsys_config_notification(void)
672 {
673  cmap_track_handle_t cmap_track;
674 
675  cmap_track_add(cmap_handle, "logging.",
677  main_logging_notify,
678  NULL,
679  &cmap_track);
680 
681  cmap_track_add(cmap_handle, "config.reload_in_progress",
683  main_logging_notify,
684  NULL,
685  &cmap_track);
686 }
687 #endif
688 
690 #ifndef LOGCONFIG_USE_ICMAP
691  cmap_handle_t cmap_h,
692  const char *default_logfile,
693 #endif
694  const char **error_string)
695 {
696  const char *error_reason = error_string_response;
697 
698 #ifndef LOGCONFIG_USE_ICMAP
699  if (!cmap_h) {
700  error_reason = "No cmap handle";
701  return (-1);
702  }
703  if (!default_logfile) {
704  error_reason = "No default logfile";
705  return (-1);
706  }
707  cmap_handle = cmap_h;
708  main_logfile = default_logfile;
709 #endif
710 
711  if (corosync_main_config_read_logging(error_string) < 0) {
712  error_reason = *error_string;
713  goto parse_error;
714  }
715 
716  add_logsys_config_notification();
717 
718  return 0;
719 
720 parse_error:
721  snprintf (error_string_response, sizeof(error_string_response),
722  "parse error in config: %s.\n",
723  error_reason);
724 
725  *error_string = error_string_response;
726  return (-1);
727 }
#define LOGSYS_DEBUG_TRACE
Definition: logsys.h:92
#define CMAP_TRACK_DELETE
Definition: cmap.h:79
cs_error_t cmap_track_add(cmap_handle_t handle, const char *key_name, int32_t track_type, cmap_notify_fn_t notify_fn, void *user_data, cmap_track_handle_t *cmap_track_handle)
Add tracking function for given key_name.
Definition: lib/cmap.c:935
const char * icmap_iter_next(icmap_iter_t iter, size_t *value_len, icmap_value_types_t *type)
Return next item in iterator iter.
Definition: icmap.c:1111
#define MAP_KEYNAME_MAXLEN
Definition: logconfig.c:49
#define CMAP_TRACK_MODIFY
Definition: cmap.h:80
uint32_t value
void icmap_iter_finalize(icmap_iter_t iter)
Finalize iterator.
Definition: icmap.c:1132
cs_error_t cmap_iter_next(cmap_handle_t handle, cmap_iter_handle_t iter_handle, char key_name[], size_t *value_len, cmap_value_types_t *type)
Return next item in iterator iter.
Definition: lib/cmap.c:836
cmap_handle_t cmap_handle
Definition: sam.c:137
#define CMAP_TRACK_ADD
Definition: cmap.h:78
#define map_get_string(key_name, value)
Definition: logconfig.c:50
#define CMAP_KEYNAME_MAXLEN
Definition: cmap.h:69
int logsys_config_file_set(const char *subsys, const char **error_string, const char *file)
to close a logfile, just invoke this function with a NULL file or if you want to change logfile...
Definition: logsys.c:540
cs_error_t cmap_iter_init(cmap_handle_t handle, const char *prefix, cmap_iter_handle_t *cmap_iter_handle)
Initialize iterator with given prefix.
Definition: lib/cmap.c:781
int _logsys_subsys_create(const char *subsys, const char *filename)
_logsys_subsys_create
Definition: logsys.c:436
#define LOGSYS_DEBUG_ON
Definition: logsys.h:91
#define log_printf(level, format, args...)
Definition: logsys.h:320
Structure passed as new_value and old_value in change callback.
Definition: cmap.h:111
#define LOGSYS_MODE_OUTPUT_FILE
Definition: logsys.h:58
cs_error_t cmap_iter_finalize(cmap_handle_t handle, cmap_iter_handle_t iter_handle)
Finalize iterator.
Definition: lib/cmap.c:896
#define ICMAP_TRACK_DELETE
Definition: icmap.h:77
const void * data
Definition: cmap.h:114
#define LOGSYS_LEVEL_WARNING
Definition: logsys.h:71
#define ICMAP_TRACK_MODIFY
Definition: icmap.h:78
int logsys_config_debug_set(const char *subsys, unsigned int value)
enabling debug, disable message priority filtering.
Definition: logsys.c:798
int logsys_config_syslog_facility_set(const char *subsys, unsigned int facility)
per system/subsystem settings.
Definition: logsys.c:649
int logsys_config_mode_set(const char *subsys, unsigned int mode)
logsys_config_mode_set
Definition: logsys.c:506
void * user_data
Definition: sam.c:127
char * logsys_format_get(void)
logsys_format_get
Definition: logsys.c:644
#define LOGSYS_MODE_OUTPUT_SYSLOG
Definition: logsys.h:60
#define ICMAP_TRACK_ADD
Definition: icmap.h:76
#define LOGSYS_DEBUG_OFF
Definition: logsys.h:90
int corosync_log_config_read(cmap_handle_t cmap_h, const char *default_logfile, const char **error_string)
Definition: logconfig.c:689
#define LOGSYS_LEVEL_DEBUG
Definition: logsys.h:74
uint64_t cmap_track_handle_t
Definition: cmap.h:64
int logsys_config_syslog_priority_set(const char *subsys, unsigned int priority)
logsys_config_syslog_priority_set
Definition: logsys.c:656
void logsys_blackbox_set(int enable)
Definition: logsys.c:858
#define CMAP_TRACK_PREFIX
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem.nodeid", "totem.version", ...
Definition: cmap.h:87
void logsys_config_apply(void)
logsys_config_apply
Definition: logsys.c:784
int logsys_priority_id_get(const char *name)
logsys_priority_id_get
Definition: logsys.c:824
uint64_t cmap_iter_handle_t
Definition: cmap.h:59
unsigned int logsys_config_mode_get(const char *subsys)
logsys_config_mode_get
Definition: logsys.c:528
icmap_iter_t icmap_iter_init(const char *prefix)
Initialize iterator with given prefix.
Definition: icmap.c:1105
int logsys_config_logfile_priority_set(const char *subsys, unsigned int priority)
logsys_config_logfile_priority_set
Definition: logsys.c:683
uint64_t cmap_handle_t
Definition: cmap.h:54
#define LOGSYS_MODE_OUTPUT_STDERR
Definition: logsys.h:59
qb_map_iter_t * icmap_iter_t
Itterator type.
Definition: icmap.h:123
Structure passed as new_value and old_value in change callback.
Definition: icmap.h:91
cs_error_t icmap_track_add(const char *key_name, int32_t track_type, icmap_notify_fn_t notify_fn, void *user_data, icmap_track_t *icmap_track)
Add tracking function for given key_name.
Definition: icmap.c:1175
int logsys_format_set(const char *format)
configuration bits that can only be done for the whole system
Definition: logsys.c:586
#define ICMAP_TRACK_PREFIX
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem.nodeid", "totem.version", ...
Definition: icmap.h:85