2.6 KiB
2.6 KiB
SKILL: Log Aggregator (Universal Literate Note)
Overview
The Log Aggregator monitors and summarizes system logs to provide insights into agent behavior and system health.
Phase A: Demand (PRD)
1. Purpose
Collect and summarize agent logs.
2. User Needs
- Scan: Retrieve logs from the system.
- Summarize: Provide a high-level summary of recent activities.
Phase B: Blueprint (PROTOCOL)
Phase B: Blueprint (PROTOCOL)
1. Architectural Intent
The Log Aggregator will employ a modular architecture, consisting of a Log Source Connector, a Summarization Engine, and a Presenter. This allows for flexibility in adapting to different log formats and presentation styles. The system will prioritize low overhead impact on the monitored system.
2. Semantic Interfaces (Lisp Signatures)
a. Log Source Connector
;;; Function: fetch-logs
;;; Description: Retrieves logs based on specified criteria.
;;; Parameters:
;;; :source (keyword) - Specifies the log source (e.g., :systemd, :file, :journald).
;;; :start-time (timestamp) - Optional. The starting timestamp for the logs.
;;; :end-time (timestamp) - Optional. The ending timestamp for the logs.
;;; :filters (list) - Optional. A list of filters to apply to the logs (e.g., '((:level . :error) (:component . "foo"))).
;;; Returns: A list of log entries (each entry being a plist).
(defun fetch-logs (&key source start-time end-time filters)
...)
b. Summarization Engine
;;; Function: summarize-logs
;;; Description: Summarizes a list of log entries.
;;; Parameters:
;;; :log-entries (list) - A list of log entries (plists).
;;; :summary-type (keyword) - Specifies the type of summary (e.g., :count-by-level, :count-by-component, :recent-errors).
;;; Returns: A summary of the logs (a plist).
(defun summarize-logs (&key log-entries summary-type)
...)
c. Presenter
;;; Function: present-summary
;;; Description: Presents a log summary in a human-readable format.
;;; Parameters:
;;; :summary (plist) - A log summary as returned by `summarize-logs`.
;;; :format (keyword) - Specifies the output format (e.g., :text, :html).
;;; Returns: A string containing the formatted summary.
(defun present-summary (&key summary format)
...)