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 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", )