Skip to content

Feature/redfish clear logs - #310

Open
amd-ansonyim wants to merge 5 commits into
developmentfrom
feature/redfish_clear_logs
Open

amd-ansonyim wants to merge 5 commits into
developmentfrom
feature/redfish_clear_logs

Conversation

@amd-ansonyim

Copy link
Copy Markdown
Collaborator

Summary

  • OOB Redfish collectors currently pull log data but do not clear the log stores afterward. This means subsequent pulls collect the same data. This PR adds opt-in, post-collection clearing via LogService.ClearLog to all three OOB Redfish plugins (RedfishEndpointPlugin, RedfishOemDiagPlugin, AmcRedfishDiagPlugin).
  • Updated PLUGIN_DOC (note: AmcRedfishDiagPlugin is absent from PLUGIN_DOC.md — pre-existing limitation of the doc generator [the plugin inherits from DataPlugin directly rather than OOBandDataPlugin, so the OOB discovery loop does not find it])
  • LogService.ClearLog on event-type services (EventLog, FaultLog, Journal) clears accumulated entries — effective for deduplication
  • LogService.ClearLog on dump/diagnostic services (DiagLogs, Dump, Manager) clears bundle entry references; the next CollectDiagnosticData produces a fresh dump from current system state

Test plan

  • pytest test/unit
  • pytest test/functional (if applicable)
  • pre-commit run --all-files

Checklist

  • Added/updated tests (or explained why not)
  • Updated docs/README if behavior changed
  • No secrets or credentials committed

Adds opt-in post-collection log clearing to RedfishEndpointCollector via
a new clear_log_uris collection arg. Each URI is POSTed with an empty body
after all GETs succeed. Failures downgrade the result to WARNING without
affecting the collected data.

New utility module nodescraper/connection/redfish/redfish_clear_log.py
provides discovery (discover_clear_log_endpoints) and execution
(clear_redfish_logs) following ARC's RedfishTool pattern:
- Skips OverWritePolicy=NeverOverWrites stores
- Continues on individual failures
- Includes BMC response body in error messages for diagnosis

Base layer additions:
- RedfishPostResult model (mirrors RedfishGetResult)
- RedfishDataCollector._run_redfish_post() helper

New collection_args fields:
- clear_log_uris: list[str] - explicit ClearLog action URIs to POST to

Result message format:
  Collected N endpoint(s)[; cleared M log store(s)][; K log store(s) failed to clear]

Tests: 43 new unit tests across test_redfish_clear_log.py and
test_redfish_endpoint_collector.py.
@github-actions github-actions Bot added documentation Improvements or additions to documentation tests framework plugins-ooband labels Oct 7, 2026
le=3600,
description="Max seconds to wait for each CollectDiagnosticData task.",
)
clear_logs_after_collection: bool = Field(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of behavior changes are needed for this functionality: clear_logs_after_collection runs after any successful collection, but the AMC path then clears every ClearLog store under the configured managers and systems, including stores that were not collected and collections that failed in the same run. The OEM path does the same for its log service when only one diagnostic type succeeds. Clear only the log service whose collection fully succeeded.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched AMC collector to only clear successful log pulls.
OEM will discuss internally

path = endpoint.path
try:
resp = conn.post(path, json={})
success = resp.ok

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI i think OK is a 202 which is accepted not completed or finished (204 or 200) i think this needs some rework

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched to accept 200, 202, 204

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation framework plugins-ooband tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants