corosync  2.4.4
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  free(value);
527  goto parse_error;
528  }
529  }
530 
531  return (0);
532 
533 parse_error:
534  *error_string = error_reason;
535 
536  return (-1);
537 }
538 
539 static int corosync_main_config_read_logging (
540  const char **error_string)
541 {
542  const char *error_reason;
543 #ifdef LOGCONFIG_USE_ICMAP
544  icmap_iter_t iter;
545  const char *key_name;
546 #else
547  cmap_iter_handle_t iter;
548  char key_name[CMAP_KEYNAME_MAXLEN];
549 #endif
550  char key_subsys[MAP_KEYNAME_MAXLEN];
551  char key_item[MAP_KEYNAME_MAXLEN];
552  int res;
553 
554  /* format set is supported only for toplevel */
555  if (corosync_main_config_format_set(&error_reason) < 0) {
556  goto parse_error;
557  }
558 
559  if (corosync_main_config_blackbox_set(&error_reason) < 0) {
560  goto parse_error;
561  }
562 
563  if (corosync_main_config_set ("logging", NULL, &error_reason) < 0) {
564  goto parse_error;
565  }
566 
567  /*
568  * we will need 2 of these to compensate for new logging
569  * config format
570  */
571 #ifdef LOGCONFIG_USE_ICMAP
572  iter = icmap_iter_init("logging.logger_subsys.");
573  while ((key_name = icmap_iter_next(iter, NULL, NULL)) != NULL) {
574 #else
575  cmap_iter_init(cmap_handle, "logging.logger_subsys.", &iter);
576  while ((cmap_iter_next(cmap_handle, iter, key_name, NULL, NULL)) == CS_OK) {
577 #endif
578  res = sscanf(key_name, "logging.logger_subsys.%[^.].%s", key_subsys, key_item);
579 
580  if (res != 2) {
581  continue ;
582  }
583 
584  if (strcmp(key_item, "subsys") != 0) {
585  continue ;
586  }
587 
588  snprintf(key_item, MAP_KEYNAME_MAXLEN, "logging.logger_subsys.%s", key_subsys);
589 
590  if (corosync_main_config_set(key_item, key_subsys, &error_reason) < 0) {
591  goto parse_error;
592  }
593  }
594 #ifdef LOGCONFIG_USE_ICMAP
595  icmap_iter_finalize(iter);
596 #else
598 #endif
599 
601  return 0;
602 
603 parse_error:
604  *error_string = error_reason;
605 
606  return (-1);
607 }
608 
609 #ifdef LOGCONFIG_USE_ICMAP
610 static void main_logging_notify(
611  int32_t event,
612  const char *key_name,
613  struct icmap_notify_value new_val,
614  struct icmap_notify_value old_val,
615  void *user_data)
616 #else
617 static void main_logging_notify(
618  cmap_handle_t cmap_handle_unused,
619  cmap_handle_t cmap_track_handle_unused,
620  int32_t event,
621  const char *key_name,
622  struct cmap_notify_value new_val,
623  struct cmap_notify_value old_val,
624  void *user_data)
625 #endif
626 {
627  const char *error_string;
628  static int reload_in_progress = 0;
629 
630  /* If a full reload happens then suspend updates for individual keys until
631  * it's all completed
632  */
633  if (strcmp(key_name, "config.reload_in_progress") == 0) {
634  if (*(uint8_t *)new_val.data == 1) {
635  reload_in_progress = 1;
636  } else {
637  reload_in_progress = 0;
638  }
639  }
640  if (reload_in_progress) {
641  log_printf(LOGSYS_LEVEL_DEBUG, "Ignoring key change, reload in progress. %s\n", key_name);
642  return;
643  }
644 
645  /*
646  * Reload the logsys configuration
647  */
648  if (logsys_format_set(NULL) == -1) {
649  fprintf (stderr, "Unable to setup logging format.\n");
650  }
651  corosync_main_config_read_logging(&error_string);
652 }
653 
654 #ifdef LOGCONFIG_USE_ICMAP
655 static void add_logsys_config_notification(void)
656 {
657  icmap_track_t icmap_track = NULL;
658 
659  icmap_track_add("logging.",
661  main_logging_notify,
662  NULL,
663  &icmap_track);
664 
665  icmap_track_add("config.reload_in_progress",
667  main_logging_notify,
668  NULL,
669  &icmap_track);
670 }
671 #else
672 static void add_logsys_config_notification(void)
673 {
674  cmap_track_handle_t cmap_track;
675 
676  cmap_track_add(cmap_handle, "logging.",
678  main_logging_notify,
679  NULL,
680  &cmap_track);
681 
682  cmap_track_add(cmap_handle, "config.reload_in_progress",
684  main_logging_notify,
685  NULL,
686  &cmap_track);
687 }
688 #endif
689 
691 #ifndef LOGCONFIG_USE_ICMAP
692  cmap_handle_t cmap_h,
693  const char *default_logfile,
694 #endif
695  const char **error_string)
696 {
697  const char *error_reason = error_string_response;
698 
699 #ifndef LOGCONFIG_USE_ICMAP
700  if (!cmap_h) {
701  error_reason = "No cmap handle";
702  return (-1);
703  }
704  if (!default_logfile) {
705  error_reason = "No default logfile";
706  return (-1);
707  }
708  cmap_handle = cmap_h;
709  main_logfile = default_logfile;
710 #endif
711 
712  if (corosync_main_config_read_logging(error_string) < 0) {
713  error_reason = *error_string;
714  goto parse_error;
715  }
716 
717  add_logsys_config_notification();
718 
719  return 0;
720 
721 parse_error:
722  snprintf (error_string_response, sizeof(error_string_response),
723  "parse error in config: %s.\n",
724  error_reason);
725 
726  *error_string = error_string_response;
727  return (-1);
728 }
#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:933
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:1103
#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:1124
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:538
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:434
#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:894
#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:796
int logsys_config_syslog_facility_set(const char *subsys, unsigned int facility)
per system/subsystem settings.
Definition: logsys.c:647
int logsys_config_mode_set(const char *subsys, unsigned int mode)
logsys_config_mode_set
Definition: logsys.c:504
void * user_data
Definition: sam.c:127
char * logsys_format_get(void)
logsys_format_get
Definition: logsys.c:642
#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:690
#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:654
void logsys_blackbox_set(int enable)
Definition: logsys.c:856
#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:782
int logsys_priority_id_get(const char *name)
logsys_priority_id_get
Definition: logsys.c:822
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:526
icmap_iter_t icmap_iter_init(const char *prefix)
Initialize iterator with given prefix.
Definition: icmap.c:1097
int logsys_config_logfile_priority_set(const char *subsys, unsigned int priority)
logsys_config_logfile_priority_set
Definition: logsys.c:681
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:1167
int logsys_format_set(const char *format)
configuration bits that can only be done for the whole system
Definition: logsys.c:584
#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