Where/how can I set HA command line arguments (HA OS) to set log_rotate_days

I found the variable that controls whether HA periodically switches logs, and how many to keep in bootstrap.py.

Code snippet backupCount=log_rotate_days
        err_handler: logging.handlers.RotatingFileHandler | logging.handlers.TimedRotatingFileHandler
        if log_rotate_days:
            err_handler = logging.handlers.TimedRotatingFileHandler(
                err_log_path, when="midnight", backupCount=log_rotate_days
            )
        else:
            err_handler = logging.handlers.RotatingFileHandler(
                err_log_path, backupCount=1
            )

And traced it back to the command line arguments when HA is first run in __main__.py.

Code snippet: list of HAs command line arguments
    runtime_conf = runner.RuntimeConfig(
        config_dir=config_dir,
        verbose=args.verbose,
        log_rotate_days=args.log_rotate_days,
        log_file=args.log_file,
        log_no_color=args.log_no_color,
        skip_pip=args.skip_pip,
        safe_mode=args.safe_mode,
        debug=args.debug,
        open_ui=args.open_ui,
    )

But I don’t know where I can actually go to modify the command line arguments, as I run the Home Assistant OS on a RPi4 and used the official image.

I’d appreciate if someone could guide me to where to go, or redirect me if there is another method to achieve my goal.

3 Likes