mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 10:45:21 +03:00
Update nginx logging location if logger default is not warning, error, or critical
This commit is contained in:
parent
bcef94de4a
commit
67bf3a4a7b
@ -212,6 +212,19 @@ class FrigateApp:
|
||||
|
||||
migrate_db.close()
|
||||
|
||||
def init_nginx_manager(self) -> None:
|
||||
with open("/usr/local/nginx/conf/nginx.conf", "r") as f:
|
||||
file_lines = f.readlines()
|
||||
if self.config.logger.default not in ["warning", "error", "critical"]:
|
||||
with open("/usr/local/nginx/conf/nginx.conf", "w") as f:
|
||||
for line in file_lines:
|
||||
if "access_log /dev/shm/logs/nginx/access_log main;" in line:
|
||||
line = line.replace(
|
||||
"access_log /dev/shm/logs/nginx/access_log main;",
|
||||
"access_log /dev/stdout main;",
|
||||
)
|
||||
f.write(line)
|
||||
|
||||
def init_go2rtc(self) -> None:
|
||||
for proc in psutil.process_iter(["pid", "name"]):
|
||||
if proc.info["name"] == "go2rtc":
|
||||
@ -474,6 +487,7 @@ class FrigateApp:
|
||||
self.init_database()
|
||||
self.init_onvif()
|
||||
self.init_recording_manager()
|
||||
self.init_nginx_manager()
|
||||
self.init_go2rtc()
|
||||
self.bind_database()
|
||||
self.init_dispatcher()
|
||||
|
||||
@ -1613,7 +1613,7 @@ def logs(service: str):
|
||||
"go2rtc": "/dev/shm/logs/go2rtc/current",
|
||||
"nginx": "/dev/shm/logs/nginx/error_log"
|
||||
if current_app.frigate_config.logger.default in ["warning", "error", "critical"]
|
||||
else "/dev/shm/logs/nginx/access_log",
|
||||
else "/dev/shm/logs/nginx/current",
|
||||
}
|
||||
service_location = log_locations.get(service)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user