Commit graph

15 commits

Author SHA1 Message Date
David Lamparter 0beb61abc2 vtysh: dispatch unique-id backtrace cmd properly
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-16 18:51:22 +01:00
David Lamparter ef990bd94b lib: add debug uid XXXXX-XXXXX backtrace
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-11-10 12:36:50 +01:00
David Lamparter c6610ea98f lib: make a few log symbols accessible
Might've made a few things too many `static` there.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-18 21:05:21 +02:00
David Lamparter ba9256d2d0 lib: add hook for show logging CLI
... so additional targets can print their state.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-18 20:56:53 +02:00
David Lamparter 9c2aa91921 lib: de-conflict log-filter CLI command
`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-06-18 20:56:53 +02:00
Mark Stapp 7c945dff61 lib: add 'log immediate-mode' cli
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-20 12:55:08 -04:00
David Lamparter 48843422d3 vtysh: add lib/log_vty.c to vtysh_scan
Rather than copying everything over, include the file in vtysh_scan for
automatic pickup.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-04-15 23:12:45 +02:00
David Lamparter a3c6749860 lib: add [XXXXX-XXXXX] log prefix & config
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-22 12:50:27 +01:00
David Lamparter 8451921b70 *: require semicolon after DEFINE_HOOK & co.
See previous commit.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17 06:18:17 +01:00
Quentin Young 0880854185 pimd, lib: suppress compiler warnings on snprintf
truncation warnings on old compilers

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-21 13:13:06 -04:00
Quentin Young fc746f1c01 *: manually remove some more sprintf
Take care of some more complicated cases by hand

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-20 19:14:33 -04:00
David Lamparter 1c4086281f lib/log: re-add log filtering
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-01 06:53:26 +02:00
David Lamparter 0bdeb5e58d lib: rewrite zlog lock-free & TLS-buffered
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>
2020-04-01 06:53:26 +02:00
Stephen Worley 8ad7c5c2e7 lib: Remove extraneous spacing/output filter cmds
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-19 17:20:24 -04:00
Stephen Worley f73126c31a lib,vtysh: Add vtysh commands for log-filter
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>
2019-06-19 17:20:24 -04:00