Skip to content

lib: add "send log" command to log a message#19030

Merged
Jafaral merged 2 commits intoFRRouting:masterfrom
LabNConsulting:chopps/add-send-log
Jun 16, 2025
Merged

lib: add "send log" command to log a message#19030
Jafaral merged 2 commits intoFRRouting:masterfrom
LabNConsulting:chopps/add-send-log

Conversation

@choppsv1
Copy link
Contributor

Allow sending a log message from vtysh. This can be useful to mark logs as well as test logging configuration.

@frrbot frrbot bot added the libfrr label Jun 14, 2025
@choppsv1 choppsv1 force-pushed the chopps/add-send-log branch 2 times, most recently from 931fcf4 to b852129 Compare June 14, 2025 19:09
@frrbot frrbot bot added the tests Topotests, make check, etc label Jun 14, 2025
@github-actions github-actions bot added size/L and removed size/M labels Jun 14, 2025
@choppsv1 choppsv1 force-pushed the chopps/add-send-log branch from 7fd58bb to fc5717a Compare June 15, 2025 00:24
@github-actions github-actions bot added size/M and removed size/L labels Jun 15, 2025
lib/log_vty.c Outdated
LOG_LEVEL_DESC
"Log message to send\n")
{
// const char *s;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we drop this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup.

log record-priority
log file frr.log

ip route 11.11.11.11/32 lo No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which the static route? Probably not, but it's a artifact of the test tools current workings.

I use load_frr_config() now exclusively which scans frr.conf to determine which daemons to load. It doesn't actually check for static routes to load staticd right now, instead topotest just always loads staticd. But this is a practice I use to make staticd load if I needed it.

@choppsv1 choppsv1 force-pushed the chopps/add-send-log branch from fc5717a to 7bea8e5 Compare June 15, 2025 09:26
lib/log_vty.c Outdated

DEFPY(send_log,
send_log_cmd,
"send log [severity <emergency|alert|critical|error|warning|notice|info|debug>$levelarg] LINE...",
Copy link
Member

@Jafaral Jafaral Jun 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In all commands and documentation we refer to these as "log levels" while "severity" don't show up anywhere.

I suggest making the command:

send log [level LEVEL]...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was specifically not using level here. We have mixed "priority" log record-priority and level log stdout LEVEL both of which use home-grown non-std keywords emergencies, alerts, critical, errors, warnings, notifications, informational, or debugging.

I'm trying to move us to the industry standard syslog severity notation. I have another PR which adds log record-severity so that the output to the log is using standard syslog severity tags, which auto-stylizing/coloring pagers as well as most users scripts understand.

Currently we output lower-case homegrown tags like errors: foo and debugging: foo. log record-severity is going to output industry standard tags ERROR: , DEBUG: ...

This change is going along with that.

Copy link
Contributor Author

@choppsv1 choppsv1 Jun 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commercial router variant of this takes only an integer value from 0-7 with no keyword

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually nm we can make this change later if we want to. I'll just use level and the current home-grown keyword values

@choppsv1 choppsv1 force-pushed the chopps/add-send-log branch from 7bea8e5 to 4e9d082 Compare June 15, 2025 23:20
@github-actions github-actions bot added size/L and removed size/M labels Jun 15, 2025
choppsv1 added 2 commits June 16, 2025 00:48
Signed-off-by: Christian Hopps <chopps@labn.net>
Signed-off-by: Christian Hopps <chopps@labn.net>
@choppsv1 choppsv1 force-pushed the chopps/add-send-log branch from 4e9d082 to 3ca6a23 Compare June 16, 2025 00:48
@github-actions github-actions bot added size/M and removed size/L labels Jun 16, 2025
@Jafaral Jafaral merged commit 37dd003 into FRRouting:master Jun 16, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libfrr master size/M tests Topotests, make check, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants