diff options
| author | Christian Hopps <chopps@labn.net> | 2023-05-03 00:41:19 -0400 | 
|---|---|---|
| committer | Christian Hopps <chopps@labn.net> | 2023-05-04 14:48:59 -0400 | 
| commit | 3701780a15f90e9e64a32fd24bb8d2887b3a4ef9 (patch) | |
| tree | 090451bdba5cca05e6cde063425a2933b24106af /lib/command.c | |
| parent | 27797fec2cb76c7a5526b34ca8494ec72a633f29 (diff) | |
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 <chopps@labn.net>
Diffstat (limited to 'lib/command.c')
| -rw-r--r-- | lib/command.c | 8 | 
1 files changed, 8 insertions, 0 deletions
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  | 
