fix ui
This commit is contained in:
@@ -11,6 +11,7 @@ from .correlation import correlate_source_ips
|
||||
from .event_context import build_event_context
|
||||
from .graylog_mcp import GraylogMcpClient
|
||||
from .graylog_source import GraylogStreamSource
|
||||
from .history import HistoryStore
|
||||
from .llm import ollama_dashboard_assessment
|
||||
from .logs import local_in_failures, read_events, summarize_events, top_field_values
|
||||
from .mitigation import parse_allowlist, suggest_block_candidates
|
||||
@@ -29,6 +30,7 @@ def build_status(
|
||||
anomaly_limit: int = 20,
|
||||
baseline_path: str | None = None,
|
||||
config_path: str | None = None,
|
||||
history_path: str | None = None,
|
||||
) -> dict[str, object]:
|
||||
config_store = ConfigStore(config_path) if config_path else None
|
||||
config_exists = bool(config_store and config_store.path.exists())
|
||||
@@ -93,7 +95,7 @@ def build_status(
|
||||
except Exception as exc:
|
||||
policy_error = str(exc)
|
||||
|
||||
return {
|
||||
status = {
|
||||
"generated_at": int(time.time()),
|
||||
"log_path": log_path,
|
||||
"policy_path": policy_path,
|
||||
@@ -149,6 +151,11 @@ def build_status(
|
||||
"policy_findings": policy_findings,
|
||||
"policy_error": policy_error,
|
||||
}
|
||||
if history_path:
|
||||
history = HistoryStore(history_path)
|
||||
history.record(status)
|
||||
status["history"] = history.recent()
|
||||
return status
|
||||
|
||||
|
||||
def add_llm_assessment(status: dict[str, object], *, previous: str | None = None, model: str | None = None, timeout: int | None = None) -> None:
|
||||
@@ -190,6 +197,7 @@ def monitor_loop(
|
||||
llm_timeout: int | None = None,
|
||||
baseline_path: str | None = None,
|
||||
config_path: str | None = None,
|
||||
history_path: str | None = None,
|
||||
) -> None:
|
||||
print(f"Monitoring {log_path}")
|
||||
print(f"Writing status to {output}")
|
||||
@@ -201,7 +209,7 @@ def monitor_loop(
|
||||
effective_model = str(runtime.get("llm_model") or llm_model or "")
|
||||
status = build_status(
|
||||
log_path, policy_path=policy_path, anomaly_limit=anomaly_limit,
|
||||
baseline_path=baseline_path, config_path=config_path,
|
||||
baseline_path=baseline_path, config_path=config_path, history_path=history_path,
|
||||
)
|
||||
if effective_llm:
|
||||
now = int(time.time())
|
||||
|
||||
Reference in New Issue
Block a user