From 1eb18d2cd21b173bdf3b87a88c3614efda723a5d Mon Sep 17 00:00:00 2001 From: Victor Balbuena <36045442+vbalbp@users.noreply.github.com> Date: Thu, 26 Sep 2024 16:03:54 +0200 Subject: [PATCH] add default log location for snapshot (#87) --- dynatrace_extension/sdk/snapshot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dynatrace_extension/sdk/snapshot.py b/dynatrace_extension/sdk/snapshot.py index d963f4d..7c11b30 100644 --- a/dynatrace_extension/sdk/snapshot.py +++ b/dynatrace_extension/sdk/snapshot.py @@ -193,6 +193,8 @@ def find_log_dir() -> Path: for line in f: if line.startswith("LogDir"): log_dir = line.split("=")[1].strip() + if not log_dir: + return Path(os.path.expandvars("%PROGRAMDATA%") + "/dynatrace/oneagent/log") if os.name == "nt" else Path("/var/log/dynatrace/oneagent") return Path(log_dir) msg = f"Could not find LogDir in {installation_conf}" raise Exception(msg)