add more streams
This commit is contained in:
@@ -7,6 +7,7 @@ from pathlib import Path
|
||||
from .anomaly import anomaly_summary, detect_source_anomalies
|
||||
from .baseline import BaselineStore
|
||||
from .config import ConfigStore
|
||||
from .event_context import build_event_context
|
||||
from .graylog_mcp import GraylogMcpClient
|
||||
from .graylog_source import GraylogStreamSource
|
||||
from .llm import ollama_dashboard_assessment
|
||||
@@ -40,7 +41,17 @@ def build_status(
|
||||
events = []
|
||||
else:
|
||||
try:
|
||||
events, mcp_status = GraylogStreamSource(GraylogMcpClient(url, token), str(runtime_values.get("graylog_stream", "")), str(runtime_values.get("graylog_query", "*")), str(runtime_values.get("graylog_field_mapping", ""))).fetch()
|
||||
configured_streams = runtime_values.get("graylog_streams", [])
|
||||
stream_ids = [str(item.get("id")) for item in configured_streams if isinstance(item, dict) and item.get("enabled") and item.get("id")]
|
||||
if not stream_ids:
|
||||
stream_ids = [str(runtime_values.get("graylog_stream", ""))]
|
||||
stream_statuses = []
|
||||
events = []
|
||||
for stream_id in stream_ids:
|
||||
stream_events, stream_status = GraylogStreamSource(GraylogMcpClient(url, token), stream_id, str(runtime_values.get("graylog_query", "*")), str(runtime_values.get("graylog_field_mapping", ""))).fetch()
|
||||
events.extend(stream_events)
|
||||
stream_statuses.append({"stream_id": stream_id, **stream_status})
|
||||
mcp_status = {"status": "connected", "streams": stream_statuses, "events_fetched": len(events)}
|
||||
except RuntimeError as exc:
|
||||
mcp_status = {"status": "error", "error": str(exc)}
|
||||
events = []
|
||||
@@ -95,6 +106,7 @@ def build_status(
|
||||
"top_subtypes": top_field_values(events, "subtype", limit=10),
|
||||
"local_in_failures": local_in_failures(events, limit=10),
|
||||
},
|
||||
"event_context": build_event_context(events),
|
||||
"anomalies": [
|
||||
{
|
||||
"subject": finding.subject,
|
||||
|
||||
Reference in New Issue
Block a user