From 3701780a15f90e9e64a32fd24bb8d2887b3a4ef9 Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Wed, 3 May 2023 00:41:19 -0400 Subject: lib: log commands read from config file When the user specifies `--command-log-always` in CLI arguments then also log commands executed from loading the config file. Signed-off-by: Christian Hopps --- lib/command.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/command.c') diff --git a/lib/command.c b/lib/command.c index 27cd3a04bd..7a7ce3f5dc 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1303,6 +1303,14 @@ int config_from_file(struct vty *vty, FILE *fp, unsigned int *line_num) while (fgets(vty->buf, VTY_BUFSIZ, fp)) { ++(*line_num); + if (vty_log_commands) { + int len = strlen(vty->buf); + + /* now log the command */ + zlog_notice("config-from-file# %.*s", len ? len - 1 : 0, + vty->buf); + } + ret = command_config_read_one_line(vty, NULL, *line_num, 0); if (ret != CMD_SUCCESS && ret != CMD_WARNING -- cgit v1.2.3