Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apps/axon_agent/src/process_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ bool parse_http_url(const std::string& url, HttpUrl* output, std::string* error)
return true;
}

std::filesystem::path default_transient_log_dir() {
return std::filesystem::path("/tmp") / "axon-agent" / "logs";
}

} // namespace

ProcessManager::ProcessManager(std::filesystem::path state_dir)
Expand Down Expand Up @@ -794,7 +798,7 @@ std::filesystem::path ProcessManager::default_log_file(
) const {
const auto pid_file =
config.pid_file.empty() ? default_pid_file(config.process_id) : config.pid_file;
return state_dir_ / "logs" / (pid_file.stem().string() + "." + stream + ".log");
return default_transient_log_dir() / (pid_file.stem().string() + "." + stream + ".log");
}

} // namespace agent
Expand Down
12 changes: 12 additions & 0 deletions apps/axon_agent/test/test_agent_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,18 @@ auto_start: false
recorder["health_check"]["timeout_ms"].get<int>() == 250, "recorder health timeout mismatch"
);

const auto& transfer = processes["transfer"];
require(
transfer["stdout_log"].get<std::string>() ==
(std::filesystem::path("/tmp/axon-agent/logs") / "demo_robot_transfer.stdout.log").string(),
"transfer default stdout_log mismatch"
);
require(
transfer["stderr_log"].get<std::string>() ==
(std::filesystem::path("/tmp/axon-agent/logs") / "demo_robot_transfer.stderr.log").string(),
"transfer default stderr_log mismatch"
);

const auto& robot = processes["robot_startup"];
require(
robot["working_directory"].get<std::string>() == (profile_dir / "runtime").string(),
Expand Down
2 changes: 1 addition & 1 deletion docs/designs/axon-agent-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ process:
timeout_ms: 500
```

`adapter.yaml` 下的 `managed_processes.<process_id>` 使用同一组字段。`working_directory` 的相对路径按 profile 根目录解析;`pid_file`、`metadata_file`、`stdout_log`、`stderr_log` 的相对路径按 agent `state_dir` 解析。未配置 `pid_file`、`metadata_file` 和日志路径时,agent 会自动按 `profile_id + process_id` 生成隔离路径。
`adapter.yaml` 下的 `managed_processes.<process_id>` 使用同一组字段。`working_directory` 的相对路径按 profile 根目录解析;`pid_file`、`metadata_file`、`stdout_log`、`stderr_log` 的相对路径按 agent `state_dir` 解析。未配置 `pid_file`、`metadata_file` ,agent 会自动按 `profile_id + process_id` 生成隔离路径;未配置日志路径时,stdout/stderr 默认保存到 `/tmp/axon-agent/logs/<profile_id>_<process_id>.<stdout|stderr>.log`,避免一次性子进程日志长期积累在持久 state 目录

`health_check.type` 首版支持 `process`、`http`、`none`。`process` 只检查被管理进程 pid 是否仍在运行;`http` 支持 `url`、`timeout_ms` 和 `expected_status`,用于 recorder/transfer 等带本地 HTTP 端口的组件;`none` 用于明确关闭健康检查。

Expand Down
4 changes: 3 additions & 1 deletion packaging/deb/agent/default/axon-agent
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ AXON_AGENT_PORT=8090
# contain adapter.yaml and optional recorder.yaml / transfer.yaml files.
AXON_AGENT_PROFILE_PATH=/opt/axon/robots

# Runtime state, active_profile.json, child pid files, metadata, and logs.
# Runtime state, active_profile.json, child pid files, and metadata.
# Managed process stdout/stderr defaults to /tmp/axon-agent/logs unless a
# profile explicitly sets stdout_log/stderr_log.
AXON_AGENT_STATE_DIR=/var/lib/axon/agent
Loading