From d802749ab6468d3b066e991bf53a5db71d89cd53 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Fri, 1 Mar 2024 10:50:24 +0100 Subject: [PATCH 1/2] tools: Add option to frr-reload to specify alternate logfile Adding option --logfile to specify a different logfile instead of the default /var/log/frr/frr-reload.log Signed-off-by: Martin Winter --- tools/frr-reload.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/frr-reload.py b/tools/frr-reload.py index ef92e8b59faf..01684729e821 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -1904,11 +1904,17 @@ def compare_context_objects(newconf, running): help="Used by topotest to not delete debug or log file commands", ) + parser.add_argument( + "--logfile", + help="logfile for frr-reload", + default="/var/log/frr/frr-reload.log", + ) + args = parser.parse_args() # Logging # For --test log to stdout - # For --reload log to /var/log/frr/frr-reload.log + # For --reload log to --logfile (default: "/var/log/frr/frr-reload.log") if args.test or args.stdout: logging.basicConfig(format="%(asctime)s %(levelname)5s: %(message)s") @@ -1921,11 +1927,11 @@ def compare_context_objects(newconf, running): ) elif args.reload: - if not os.path.isdir("/var/log/frr/"): - os.makedirs("/var/log/frr/", mode=0o0755) + if not os.path.isdir(os.path.dirname(args.logfile)): + os.makedirs(os.path.dirname(args.logfile), mode=0o0755) logging.basicConfig( - filename="/var/log/frr/frr-reload.log", + filename=args.logfile, format="%(asctime)s %(levelname)5s: %(message)s", ) From 81719d8ae1f887f5dff4baa07a5e9472dedb276d Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Fri, 1 Mar 2024 11:01:23 +0100 Subject: [PATCH 2/2] doc: Update frr-reload doc to include new option Signed-off-by: Martin Winter --- doc/user/frr-reload.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/user/frr-reload.rst b/doc/user/frr-reload.rst index bd295dbbad2a..586d6103b583 100644 --- a/doc/user/frr-reload.rst +++ b/doc/user/frr-reload.rst @@ -25,6 +25,8 @@ There are several options that control the behavior of ``frr-reload``: * ``--stdout``: print output to stdout * ``--bindir BINDIR``: path to the vtysh executable * ``--confdir CONFDIR``: path to the existing daemon config files +* ``--logfile FILENAME``: file (with path) to logfile for the reload operation. + Default is ``/var/log/frr/frr-reload.log`` * ``--rundir RUNDIR``: path to a folder to be used to write the temporary files needed by the script to do its job. The script should have write access to it * ``--daemon DAEMON``: by default ``frr-reload.py`` assumes that we are using