docker { logs } returns no lines for containers that log to stderr
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- docker, typescript
- Lĩnh vực
- backend
Hướng nghiên cứu
Bắt đầu với DockerLogService.getContainerLogs trong api/src/unraid-api/graph/resolvers/docker/docker-log.service.ts, nơi issue cho biết chỉ có stdout được đọc từ lệnh docker. Kiểm tra cách resolver phân tích và sắp xếp các dòng có dấu thời gian, sau đó xác minh rằng truy vấn cũng trả về đầu ra stderr, bao gồm cả trường hợp tái hiện được cung cấp với một container chỉ ghi vào stderr.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment
Unraid OS Version:
7.4.0 (API 4.37.11+8e587fe2)
Are you using a reverse proxy?
Yes (NPMPlus). I reproduced the issue directly on the server through the API's unix socket (/var/run/unraid-api.sock), without the proxy. The result is the same.
Pre-submission Checklist
- I have verified that my Unraid OS is up to date
- I have tested this issue by accessing my server directly (not through a reverse proxy)
- This is not an Unraid Connect related issue (if it is, please submit via the support form instead)
Issue Description
The docker { logs } query returns an empty lines list and no error for a container that writes its log output to stderr. Containers that log to stdout return their lines as expected.
A client therefore cannot tell "the container logged nothing" from "the container logs to stderr", which is the default for Python's logging and many Go services.
Steps to Reproduce
-
Start a container that only writes to stderr:
docker run -d --name stderr-test alpine sh -c 'while true; do echo "to stderr" >&2; sleep 5; done' -
Check on the host that the output is on stderr only:
# docker logs --tail 3 stderr-test to stderr to stderr to stderr # docker logs --tail 3 stderr-test 2>/dev/null # -
Look up the container id with
query { docker { containers { id names } } }and request its logs, directly on the server:curl -s --unix-socket /var/run/unraid-api.sock http://localhost/graphql \ -H "x-api-key: $KEY" -H "Content-Type: application/json" \ -d '{"query":"{ docker { logs(id: \"<id>\", tail: 3) { lines { timestamp message } } } }"}'
Expected Behavior
The lines from both stdout and stderr, ordered by timestamp, as docker logs shows them.
Actual Behavior
{"data":{"docker":{"logs":{"lines":[]}}}}
No lines and no error. The same happens without tail and with since. On the same server, containers that log to stdout (for example jellyfin, pihole, redis) return lines through the same query.
Additional Context
DockerLogService.getContainerLogs in api/src/unraid-api/graph/resolvers/docker/docker-log.service.ts reads only stdout:
const { stdout } = await execa('docker', args);
docker logs writes the container's stderr stream to its own stderr, so that stream is dropped. The line is the same in v4.30.0, v4.35.0, v4.37.5, v4.37.11 and on main, so this is not a regression of 7.4.0.
Reading both streams would fix it, for example with execa's all: true and parsing all instead of stdout. --timestamps is already passed, so the lines can be put in order.
I searched open and closed issues and pull requests for an existing report and found none.
I first noticed this with a real container (unbound) and tracked it down with the help of an AI assistant. I ran the reproduction above myself on the server.
- Ngôn ngữ chính
- TypeScript
- Star
- 123
- Fork
- 25
- Merge trung bình
- 2 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của unraid/api
-
Temperature metrics: lm-sensors voltages, fan speeds and power are reported as temperatures (°C)Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
flash { guid } always fails: resolver no longer returns guid but the schema marks it non-nullableĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
parityHistory query fails with NaN when a parity-checks.log record has an empty errors fieldĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
yavorsky/unbuilt.app#65 ·
-
CVE security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
mckinsey/agents-at-scale-ark#4091 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
factory:subtask
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 94/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
NUS-Project-SaBai/project-sabai#386 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
android needs clarification
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
super-productivity/super-productivity#12105 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày