Skip to content

[featrue] add trace log for ai-resource-version #14833

Closed

Description

@shiyiyue1102

Describe the bug
[Feature Request] Add a dedicated audit trace log file ai_resource_trace.log for AI resource lifecycle operations in Nacos version 3.2.1.2026.03.30.
(功能请求:为 Nacos 3.2.1.2026.03.30 版本新增专用审计追踪日志文件 ai_resource_trace.log,用于记录 AI 资源版本的全生命周期操作。)

Expected behavior
The system should automatically record structured trace entries into ai_resource_trace.log whenever an operator interacts with AI resources/versions. Each log entry must clearly capture:

  • Who: Operator ID / Username
  • When: Timestamp (ISO 8601 format)
  • Which Resource: Resource ID/Name & Target Version
  • What Operation: Action type and execution result
    Supported operations should include, but not be limited to:
    CREATE_DRAFT, UPLOAD_SKILL, REVIEW_REJECTED, REVIEW_APPROVED, REVIEW_FORCE_SKIP, SET_TAG, REMOVE_TAG, OFFLINE_VERSION, DELETE_VERSION, etc.
    (系统应在操作 AI 资源/版本时自动向 ai_resource_trace.log 写入结构化日志。每条日志需清晰记录:操作人、时间戳、资源标识及版本、操作类型与结果。涵盖的操作包括:创建草稿、上传 Skill、审核不通过、审核通过、审核强制跳过、设置标签、移除标签、下线资源版本、删除版本等。)

Actually behavior
Currently, these operations are either logged in the generic application log (nacos.log), scattered across different modules, or lack a unified, structured format. There is no dedicated, easily queryable audit trail specifically for AI resource version operations, making compliance auditing, security tracing, and troubleshooting inefficient.
(目前这些操作要么记录在通用的 nacos.log 中,要么分散在不同模块,缺乏统一的结构化格式。没有专门针对 AI 资源版本操作的审计追踪日志,导致合规审计、安全溯源和问题排查效率低下。)

How to Reproduce
Steps to demonstrate the current limitation:

  1. Log in to Nacos console or call API to perform AI resource operations (e.g., create draft, upload skill, approve/reject review, delete version).
  2. Check the default log directory (logs/).
  3. Observe that no dedicated ai_resource_trace.log exists, and relevant operation traces are mixed with other system logs, making it difficult to filter by operator, resource, or operation type.
    (复现当前局限性的步骤:1. 执行 AI 资源操作;2. 检查日志目录;3. 发现无专用日志文件,操作记录混杂在系统日志中,难以按操作人、资源或操作类型过滤。)

Desktop (please complete the following information):

  • OS: Any (Linux/Windows/macOS)
  • Version: nacos-server 3.2.1.2026.03.30
  • Module: AI Resource Management / Config & Audit
  • SDK: N/A (Server-side logging feature)

Additional context

  • Suggested Log Format: JSON or KV pair for easy parsing by ELK/Loki. Example:
    {"timestamp":"2026-03-30T10:15:30Z","operator":"admin_01","resource_id":"res-ai-001","version":"v1.2.0","operation":"REVIEW_APPROVED","status":"SUCCESS","ip":"192.168.1.100"}
  • Log Rotation: Recommend standard size/time-based rotation (e.g., ai_resource_trace.log.2026-03-30) to prevent disk overflow.
  • Compliance: This feature is critical for enterprise security audits and operational traceability.
  • Implementation Hint: Can leverage existing AOP/interceptor mechanisms in Nacos to capture controller/service layer calls and route them to a dedicated RollingFileAppender with a custom logger name (e.g., AI_RESOURCE_TRACE).

Activity

  1. saynoword commented on Apr 2, 2026

    @saynoword
    Contributor

    I'd like to work on this issue.

  2. added 3 commits that reference this issue on Apr 2, 2026
  3. added a commit that references this issue on Apr 3, 2026
  4. YutShang commented on Apr 9, 2026

    @YutShang

    Hi maintainers, I noticed that PR #14852 already introduced AI resource trace logging at the service/operation layer.

    I’m planning a follow-up contribution focused specifically on ai_resource_version persistence-layer coverage (both external DB and embedded Derby implementations), so that row-level DB write outcomes are traceable as well.

    Proposed scope:

    • Reuse existing AiResourceTraceService and ai-resource-trace.log (no new logger format)
    • Add persistence trace for write paths (insert, update*, delete*)
    • Include resourceType, name, version, sqlOperation, rowsAffected, and error message in ext
    • Keep success tracing configurable (off by default) to avoid log volume spikes

    Would this scope be acceptable for issue #14833, or do you prefer a different boundary?

  5. cxhello commented on Apr 10, 2026

    @cxhello
    Contributor

    /assign

  6. github-actions commented on Apr 10, 2026

    @github-actions

    This issue is currently assigned to @saynoword. Please wait for it to become available or discuss in the comments.

    此 Issue 当前已分配给 @saynoword,请等待其释放或在评论中沟通。

  7. github-actions commented on Apr 14, 2026

    @github-actions

    @saynoword, this issue has been assigned to you for 11 days with no update.
    It will be unassigned in 3 days if there is no progress.
    Please comment with a status update or submit a PR.

    @saynoword,此 Issue 已分配给您 11 天但暂无进展更新。
    如果 3 天内没有进展,将自动取消分配。
    请回复进展状态或提交 PR。

  8. github-actions commented on Apr 18, 2026

    @github-actions

    @saynoword has been unassigned due to 14 days of inactivity.
    This issue is now available for anyone to claim. Comment /assign to pick it up.

    由于 14 天未更新进展,@saynoword 已被自动取消分配。
    此 Issue 现在可供任何人认领,评论 /assign 即可认领。

  9. modified the milestones: 2.5.3, 3.2.2 on May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions