mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 17:55:21 +03:00
Return logs for services
This commit is contained in:
parent
80d071c84b
commit
7c9ccf6df3
@ -1130,3 +1130,24 @@ def vainfo():
|
|||||||
else "",
|
else "",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/logs/<service>", methods=["GET"])
|
||||||
|
def logs(service: str):
|
||||||
|
log_locations = {
|
||||||
|
"frigate": "/dev/shm/logs/frigate/current",
|
||||||
|
"go2rtc": "/dev/shm/logs/go2rtc/current",
|
||||||
|
"nginx": "/dev/shm/logs/nginx/current",
|
||||||
|
}
|
||||||
|
service_location = log_locations.get(service)
|
||||||
|
|
||||||
|
if not service:
|
||||||
|
return f"{service} is not a valid service", 404
|
||||||
|
|
||||||
|
try:
|
||||||
|
file = open(service_location, "r")
|
||||||
|
contents = file.read()
|
||||||
|
file.close()
|
||||||
|
return contents, 200
|
||||||
|
except FileNotFoundError as e:
|
||||||
|
return f"Could not find log file: {e}", 500
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user