#include "virutil.h"
#define VIR_FROM_THIS VIR_FROM_CONF
+#define DEFAULT_LOG_ROOT LOCALSTATEDIR "/log/libvirt/"
VIR_LOG_INIT("logging.log_daemon_config");
data->admin_max_clients = 5000;
data->max_size = 1024 * 1024 * 2;
data->max_backups = 3;
+ data->max_age_days = 0;
return data;
}
g_free(data->log_filters);
g_free(data->log_outputs);
+ g_free(data->log_root);
g_free(data);
}
return -1;
if (virConfGetValueSizeT(conf, "max_backups", &data->max_backups) < 0)
return -1;
+ if (virConfGetValueSizeT(conf, "max_age_days", &data->max_age_days) < 0)
+ return -1;
+ if (virConfGetValueString(conf, "log_root", &data->log_root) < 0)
+ return -1;
+ if (!data->log_root)
+ data->log_root = g_strdup(DEFAULT_LOG_ROOT);
return 0;
}
size_t max_backups;
size_t max_size;
+
+ char *log_root;
+ size_t max_age_days;
};
{ "admin_max_clients" = "5" }
{ "max_size" = "2097152" }
{ "max_backups" = "3" }
+ { "max_age_days" = "0" }
+ { "log_root" = "/var/log/libvirt" }
| int_entry "admin_max_clients"
| int_entry "max_size"
| int_entry "max_backups"
+ | int_entry "max_age_days"
+ | str_entry "log_root"
(* Each entry in the config is one of the following three ... *)
let entry = logging_entry
# Maximum number of backup files to keep. Defaults to 3,
# not including the primary active file
#max_backups = 3
+
+# Maximum age for log files to live after the last modification.
+# Defaults to 0, which means "forever".
+#
+# WARNING: since virtlogd has no way to differentiate which files it used to
+# manage, the garbage collection mechanism will collect ALL files, once its age
+# reach max_age_days. Use only if you know what you mean.
+#max_age_days = 0
+
+# Root of all logs managed by virtlogd. Used to GC logs from obsolete machines.
+#
+# WARNING: all files under this location potentially can be GC-ed. See the
+# warning for max_age_days.
+#log_root = "/var/log/libvirt"