mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
conf: add log/report_command_log config setting
This commit is contained in:
parent
a08e02afbf
commit
bd0a0ae36b
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.158 -
|
Version 2.02.158 -
|
||||||
=================================
|
=================================
|
||||||
|
Add log/report_command_log to lvm.conf to enable or disable cmd log report.
|
||||||
Add log/report_output_format to lvm.conf for default report output format.
|
Add log/report_output_format to lvm.conf for default report output format.
|
||||||
Recognize --reportformat {basic|json} option to select report output format.
|
Recognize --reportformat {basic|json} option to select report output format.
|
||||||
Add log/command_log_{sort,cols} to lvm.conf to configure command log report.
|
Add log/command_log_{sort,cols} to lvm.conf to configure command log report.
|
||||||
|
@ -478,6 +478,13 @@ allocation {
|
|||||||
# How LVM log information is reported.
|
# How LVM log information is reported.
|
||||||
log {
|
log {
|
||||||
|
|
||||||
|
# Configuration option log/report_command_log.
|
||||||
|
# If enabled, LVM will collect log during command processing.
|
||||||
|
# After that the log is reported using current output format
|
||||||
|
# as defined by report/output_format setting.
|
||||||
|
# This configuration option has an automatic default value.
|
||||||
|
# report_command_log = 0
|
||||||
|
|
||||||
# Configuration option log/command_log_sort.
|
# Configuration option log/command_log_sort.
|
||||||
# List of columns to sort by when reporting command log.
|
# List of columns to sort by when reporting command log.
|
||||||
# Possible fields are: log_seq_num, log_type, log_context, log_object_type,
|
# Possible fields are: log_seq_num, log_type, log_context, log_object_type,
|
||||||
|
@ -124,7 +124,7 @@ cfg_section(devices_CFG_SECTION, "devices", root_CFG_SECTION, 0, vsn(1, 0, 0), 0
|
|||||||
cfg_section(allocation_CFG_SECTION, "allocation", root_CFG_SECTION, CFG_PROFILABLE, vsn(2, 2, 77), 0, NULL,
|
cfg_section(allocation_CFG_SECTION, "allocation", root_CFG_SECTION, CFG_PROFILABLE, vsn(2, 2, 77), 0, NULL,
|
||||||
"How LVM selects space and applies properties to LVs.\n")
|
"How LVM selects space and applies properties to LVs.\n")
|
||||||
|
|
||||||
cfg_section(log_CFG_SECTION, "log", root_CFG_SECTION, 0, vsn(1, 0, 0), 0, NULL,
|
cfg_section(log_CFG_SECTION, "log", root_CFG_SECTION, CFG_PROFILABLE, vsn(1, 0, 0), 0, NULL,
|
||||||
"How LVM log information is reported.\n")
|
"How LVM log information is reported.\n")
|
||||||
|
|
||||||
cfg_section(backup_CFG_SECTION, "backup", root_CFG_SECTION, 0, vsn(1, 0, 0), 0, NULL,
|
cfg_section(backup_CFG_SECTION, "backup", root_CFG_SECTION, 0, vsn(1, 0, 0), 0, NULL,
|
||||||
@ -547,6 +547,11 @@ cfg_runtime(allocation_thin_pool_chunk_size_CFG, "thin_pool_chunk_size", allocat
|
|||||||
cfg(allocation_physical_extent_size_CFG, "physical_extent_size", allocation_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_EXTENT_SIZE, vsn(2, 2, 112), NULL, 0, NULL,
|
cfg(allocation_physical_extent_size_CFG, "physical_extent_size", allocation_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_EXTENT_SIZE, vsn(2, 2, 112), NULL, 0, NULL,
|
||||||
"Default physical extent size in KiB to use for new VGs.\n")
|
"Default physical extent size in KiB to use for new VGs.\n")
|
||||||
|
|
||||||
|
cfg(log_report_command_log_CFG, "report_command_log", log_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_COMMAND_LOG_REPORT, vsn(2, 2, 158), NULL, 0, NULL,
|
||||||
|
"If enabled, LVM will collect log during command processing.\n"
|
||||||
|
"After that the log is reported using current output format\n"
|
||||||
|
"as defined by report/output_format setting.\n")
|
||||||
|
|
||||||
cfg(log_command_log_sort_CFG, "command_log_sort", log_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_COMMAND_LOG_SORT, vsn(2, 2, 158), NULL, 0, NULL,
|
cfg(log_command_log_sort_CFG, "command_log_sort", log_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_COMMAND_LOG_SORT, vsn(2, 2, 158), NULL, 0, NULL,
|
||||||
"List of columns to sort by when reporting command log.\n"
|
"List of columns to sort by when reporting command log.\n"
|
||||||
"Possible fields are: log_seq_num, log_type, log_context, log_object_type,\n"
|
"Possible fields are: log_seq_num, log_type, log_context, log_object_type,\n"
|
||||||
|
@ -160,6 +160,7 @@
|
|||||||
# define DEFAULT_LOG_FACILITY LOG_USER
|
# define DEFAULT_LOG_FACILITY LOG_USER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DEFAULT_COMMAND_LOG_REPORT 0
|
||||||
#define DEFAULT_SYSLOG 1
|
#define DEFAULT_SYSLOG 1
|
||||||
#define DEFAULT_VERBOSE 0
|
#define DEFAULT_VERBOSE 0
|
||||||
#define DEFAULT_SILENT 0
|
#define DEFAULT_SILENT 0
|
||||||
|
@ -1073,14 +1073,14 @@ int report_format_init(struct cmd_context *cmd, dm_report_group_type_t *report_g
|
|||||||
int config_set = find_config_tree_node(cmd, report_output_format_CFG, NULL) != NULL;
|
int config_set = find_config_tree_node(cmd, report_output_format_CFG, NULL) != NULL;
|
||||||
const char *config_format_str = find_config_tree_str(cmd, report_output_format_CFG, NULL);
|
const char *config_format_str = find_config_tree_str(cmd, report_output_format_CFG, NULL);
|
||||||
const char *format_str = arg_str_value(cmd, reportformat_ARG, config_set ? config_format_str : NULL);
|
const char *format_str = arg_str_value(cmd, reportformat_ARG, config_set ? config_format_str : NULL);
|
||||||
|
int report_command_log = find_config_tree_bool(cmd, log_report_command_log_CFG, NULL);
|
||||||
struct report_args args = {0};
|
struct report_args args = {0};
|
||||||
struct dm_report_group *new_report_group;
|
struct dm_report_group *new_report_group;
|
||||||
struct dm_report *tmp_log_rh = NULL;
|
struct dm_report *tmp_log_rh = NULL;
|
||||||
|
|
||||||
if (!format_str) {
|
if (!format_str || !strcmp(format_str, REPORT_FORMAT_NAME_BASIC)) {
|
||||||
args.report_group_type = DM_REPORT_GROUP_SINGLE;
|
args.report_group_type = report_command_log ? DM_REPORT_GROUP_BASIC
|
||||||
} else if (!strcmp(format_str, REPORT_FORMAT_NAME_BASIC)) {
|
: DM_REPORT_GROUP_SINGLE;
|
||||||
args.report_group_type = DM_REPORT_GROUP_BASIC;
|
|
||||||
} else if (!strcmp(format_str, REPORT_FORMAT_NAME_JSON)) {
|
} else if (!strcmp(format_str, REPORT_FORMAT_NAME_JSON)) {
|
||||||
args.report_group_type = DM_REPORT_GROUP_JSON;
|
args.report_group_type = DM_REPORT_GROUP_JSON;
|
||||||
} else {
|
} else {
|
||||||
@ -1099,6 +1099,7 @@ int report_format_init(struct cmd_context *cmd, dm_report_group_type_t *report_g
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (report_command_log) {
|
||||||
if (!*log_rh) {
|
if (!*log_rh) {
|
||||||
args.report_type = CMDLOG;
|
args.report_type = CMDLOG;
|
||||||
if (!_config_report(cmd, &args))
|
if (!_config_report(cmd, &args))
|
||||||
@ -1113,6 +1114,12 @@ int report_format_init(struct cmd_context *cmd, dm_report_group_type_t *report_g
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(dm_report_group_push(new_report_group, *log_rh ? : tmp_log_rh, log_report_name))) {
|
||||||
|
log_error("Failed to add log report to report group.");
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(dm_report_group_push(new_report_group, tmp_log_rh ? : *log_rh, log_report_name))) {
|
if (!(dm_report_group_push(new_report_group, tmp_log_rh ? : *log_rh, log_report_name))) {
|
||||||
log_error("Failed to add log report to report group.");
|
log_error("Failed to add log report to report group.");
|
||||||
goto bad;
|
goto bad;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user