Skip to content

feat(agent): add read-only node logs endpoint - #833

Open
Pranav-d33 wants to merge 1 commit into
hyperledger-cello:mainfrom
Pranav-d33:feat/agent-node-logs
Open

feat(agent): add read-only node logs endpoint#833
Pranav-d33 wants to merge 1 commit into
hyperledger-cello:mainfrom
Pranav-d33:feat/agent-node-logs

Conversation

@Pranav-d33

@Pranav-d33 Pranav-d33 commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Implements GET /api/v1/nodes/logs?type=PEER&name=&tail= on the Fabric agent, prerequisite for copilot fault-log summarization. Uses docker logs with bounded tail (1..1000, default 200) and maps NotFound to 404. Adds serializer validation and view tests.

Part of #813 — prerequisite for @agamatlab's fault-log summarization tool (#3 in the
work split).

What this does

Adds GET /api/v1/nodes/logs?type=PEER&name=<name>&tail=<n> to the Fabric agent
(src/agents/hyperledger-fabric/). Returns the last N lines of Docker container logs
for a given node.

  • get_node_logs() in service.py — same pattern as the existing
    get_node_status(): reads CRYPTO_CONFIG YAML, resolves container name from org
    domain, calls container.logs(tail=tail)
  • NodeLogsRequestSerializer — validates type (PEER/ORDERER), name, and tail
    (1–1000, default 200)
  • NodeLogsResponseSerializer{ logs: str }
  • NodeViewSet.logs action — @action(detail=False, methods=['get'], url_path='logs'), maps docker.errors.NotFound to 404
  • 7 tests covering the service function, serializer bounds, and view responses
    (200/400/404)

Why separate PR

The logs endpoint is a Fabric agent change with no overlap with the dashboard panel
or the copilot endpoint. Keeping it separate so it can be reviewed and merged
independently without waiting on the larger copilot pieces.
EOF
)"

Implements GET /api/v1/nodes/logs?type=PEER&name=<name>&tail=<n>
on the Fabric agent, prerequisite for copilot fault-log
summarization. Uses docker logs with bounded tail (1..1000,
default 200) and maps NotFound to 404. Adds serializer
validation and view tests.

Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
@Pranav-d33
Pranav-d33 requested a review from a team as a code owner August 30, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant