update archgw logs file to stream access logs from container (#482)

This commit is contained in:
Adil Hafeez 2025-05-23 09:15:44 -07:00 committed by GitHub
parent d050dfb85a
commit a0d10153f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,7 +5,6 @@ import sys
import yaml
import logging
from cli.consts import ACCESS_LOG_FILES
logging.basicConfig(
level=logging.INFO,
@ -77,14 +76,18 @@ def stream_access_logs(follow):
"""
Get the archgw access logs
"""
log_file_pattern_expanded = os.path.expanduser(ACCESS_LOG_FILES)
log_files = glob.glob(log_file_pattern_expanded)
stream_command = ["tail"]
if follow:
stream_command.append("-f")
follow_arg = "-f" if follow else ""
stream_command = [
"docker",
"exec",
"archgw",
"sh",
"-c",
f"tail {follow_arg} /var/log/access_*.log",
]
stream_command.extend(log_files)
subprocess.run(
stream_command,
check=True,