summaryrefslogtreecommitdiff
path: root/lib/log_vty.c
AgeCommit message (Collapse)Author
2023-04-29lib: add build option to set startup log timestemp precisionChristian Hopps
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-26build, vtysh: extract vtysh commands from .xrefDavid Lamparter
Rather than running selected source files through the preprocessor and a bunch of perl regex'ing to get the list of all DEFUNs, use the data collected in frr.xref. This not only eliminates issues we've been having with preprocessor failures due to nonexistent header files, but is also much faster. Where extract.pl would take 5s, this now finishes in 0.2s. And since this is a non-parallelizable build step towards the end of the build (dependent on a lot of other things being done already), the speedup is actually noticeable. Also files containing CLI no longer need to be listed in `vtysh_scan` since the .xref data covers everything. `#ifndef VTYSH_EXTRACT_PL` checks are equally obsolete. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-06*: fix some malformed CLI docstringsDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-13Merge pull request #10724 from opensourcerouting/lib-rotate-logsDonald Sharp
lib: rotate log file supplied by command line
2022-03-07lib: add `monitor:<fd>` command line log targetDavid Lamparter
This provides direct raw log output with full metadata directly at startup regardless of configuration details. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-03lib: rotate log file supplied by command lineRafael Zalamena
Call `zlog_file_rotate` for command file lines as well otherwise on `SIGUSR1` the old descriptor will still be used and no new log file will be created for the rotation. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-01-17lib: autodetect systemd/journald log on stdoutDavid Lamparter
systemd sets up environment variables to allow autodetecting and switching the log format to journald native. Make use of that for the stdout logging target. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17lib: RFC5424 & journald extended syslog targetDavid Lamparter
Not much to say here, user docs are coming up in a separate commit. RFC5424 and (systemd's) journald allow passing structured key-value data. This stuffs the metadata we have available into there. The "does the system syslogd support RFC5424" question is unfortunately not easily answered, so we can only give an affirmative answer on NetBSD 5.0+ or FreeBSD 12+. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-16vtysh: dispatch unique-id backtrace cmd properlyDavid Lamparter
i.e. to whoever cares, since some unique IDs (from libfrr) are valid everywhere but some others (from the daemons) only apply to specific daemons. (Default handling aborts on first error, so configuring any unique IDs that don't exist on the first daemon vtysh connects to just failed before this.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-10lib: add `debug uid XXXXX-XXXXX backtrace`David Lamparter
Looks much prettier if `libunwind` is available, but works with glibc or libexecinfo's `backtrace()` too. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-06-18lib: make a few log symbols accessibleDavid Lamparter
Might've made a few things too many `static` there. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-18lib: add hook for `show logging` CLIDavid Lamparter
... so additional targets can print their state. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-18lib: de-conflict `log-filter` CLI commandDavid Lamparter
`log-filter WORD` was giving me a serious headache since it also matches `log WORD` due to the way the CLI token handling works. This meant that a mistyped `log something` command would silently be interpreted as a filter string, causing me serious headscratching and WTFs until I figured what was going on. Remove this UX pitfall so noone else falls into it. (Since the command was never saved to config, renaming it shouldn't cause trouble.) [Also I apparently forgot to update the docs when I transferred this over to the new zlog bits...] TODO for a rainy day: since we collect all the CLI commands anyway, we should warn somewhere for "2nd level ambiguous" commands like this. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-04-20lib: add 'log immediate-mode' cliMark Stapp
Add a cli to control immediate-output mode for logs and debugs. Add this to the user docs also. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-04-15vtysh: add lib/log_vty.c to vtysh_scanDavid Lamparter
Rather than copying everything over, include the file in vtysh_scan for automatic pickup. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-22lib: add [XXXXX-XXXXX] log prefix & configDavid Lamparter
This logs the unique ID prefix from the xref that each log message call has, and adds on/off knobs for both EC and unique ID printing. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17*: require semicolon after DEFINE_HOOK & co.David Lamparter
See previous commit. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-21pimd, lib: suppress compiler warnings on snprintfQuentin Young
truncation warnings on old compilers Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-20*: manually remove some more sprintfQuentin Young
Take care of some more complicated cases by hand Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-01lib/log: re-add log filteringDavid Lamparter
This is most of the old code bolted on top of the new "backend" infrastructure. It just wraps around zlog_fd() with the string search. Originally-by: Stephen Worley <sworley@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-01lib: rewrite zlog lock-free & TLS-bufferedDavid Lamparter
This is a full rewrite of the "back end" logging code. It now uses a lock-free list to iterate over logging targets, and the targets themselves are as lock-free as possible. (syslog() may have a hidden internal mutex in the C library; the file/fd targets use a single write() call which should ensure atomicity kernel-side.) Note that some functionality is lost in this patch: - Solaris printstack() backtraces are ditched (unlikely to come back) - the `log-filter` machinery is gone (re-added in followup commit) - `terminal monitor` is temporarily stubbed out. The old code had a race condition with VTYs going away. It'll likely come back rewritten and with vtysh support. - The `zebra_ext_log` hook is gone. Instead, it's now much easier to add a "proper" logging target. v2: TLS buffer to get some actual performance Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-19lib: Remove extraneous spacing/output filter cmdsStephen Worley
Use %% style for errors in log commands and switch tabs to a single space in output. Also, remove un-needed output for success. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-06-19lib,vtysh: Add vtysh commands for log-filterStephen Worley
Add vtysh commands to add/del/clear/show filters across all daemons and independently on each one. Add automake and clippy boilerplate for those commands as well. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>