From a0d10153f9fa019af3b848cba95eba86d5abb4f9 Mon Sep 17 00:00:00 2001 From: Adil Hafeez Date: Fri, 23 May 2025 09:15:44 -0700 Subject: [PATCH] update archgw logs file to stream access logs from container (#482) --- arch/tools/cli/utils.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/arch/tools/cli/utils.py b/arch/tools/cli/utils.py index eeb4516e..019e181c 100644 --- a/arch/tools/cli/utils.py +++ b/arch/tools/cli/utils.py @@ -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,