Documentation
¶
Index ¶
- type AnomalyInfo
- type AttributeEntry
- type ClassItem
- type Engine
- func (e *Engine) GetAllLogEntries() []tui.LogEntry
- func (e *Engine) GetAnomalies(_ context.Context, filters InsightsFilters) (string, error)
- func (e *Engine) GetCountsHistory() []tui.SeverityCounts
- func (e *Engine) GetDrain3BySeverity() map[string]*tui.Drain3Manager
- func (e *Engine) GetFrequencySnapshot() *memory.FrequencySnapshot
- func (e *Engine) GetHeatmapData() []tui.HeatmapMinute
- func (e *Engine) GetLifetimeAttrCounts() map[string]int64
- func (e *Engine) GetLifetimeAttrKeyCounts() map[string]map[string]int64
- func (e *Engine) GetLifetimeHostCounts() map[string]int64
- func (e *Engine) GetLifetimeServiceCounts() map[string]int64
- func (e *Engine) GetLifetimeSeverityCounts() map[string]int64
- func (e *Engine) GetLifetimeWordCounts() map[string]int64
- func (e *Engine) GetLogEntryCount() int
- func (e *Engine) GetSentimentHeatmap(_ context.Context, filters InsightsFilters) (string, error)
- func (e *Engine) GetServicesBySeverity() map[string][]tui.ServiceCount
- func (e *Engine) GetSeverityTimeSeries() []SeverityTimePoint
- func (e *Engine) GetStats() EngineStats
- func (e *Engine) GetStreams() []StreamInfo
- func (e *Engine) Ingest(entry tui.LogEntry)
- func (e *Engine) IngestSeverityCounts(counts tui.SeverityCounts)
- func (e *Engine) MarkStreamInactive(source, stream string)
- func (e *Engine) QueryClasses(_ context.Context, filters InsightsFilters) ([]ClassItem, error)
- func (e *Engine) QueryInsightsParams(_ context.Context, _ InsightsFilters) (*InsightsParams, error)
- func (e *Engine) QueryLogSamples(_ context.Context, filters InsightsFilters) ([]LogSample, error)
- func (e *Engine) QueryPatterns(_ context.Context, filters InsightsFilters) ([]PatternGroup, error)
- func (e *Engine) QuerySentimentData(_ context.Context, filters InsightsFilters) (*SentimentData, error)
- func (e *Engine) QuerySeverityData(_ context.Context, filters InsightsFilters) ([]SeverityGroup, error)
- func (e *Engine) QuerySeverityTimeSeries(_ context.Context, filters InsightsFilters) []SeverityTimePoint
- func (e *Engine) QuerySummary(_ context.Context, filters InsightsFilters) (string, error)
- func (e *Engine) RegisterStream(source, stream string)
- func (e *Engine) Reset()
- func (e *Engine) UpdateFrequencySnapshot(snapshot *memory.FrequencySnapshot)
- type EngineStats
- type HeatmapMinuteData
- type InsightsFilters
- type InsightsParams
- type LogSample
- type PatternGroup
- type PatternItem
- type SentimentBucket
- type SentimentData
- type SeverityGroup
- type SeverityTimePoint
- type StatusInfo
- type StreamInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnomalyInfo ¶
type AnomalyInfo struct {
Type string `json:"type"`
Severity string `json:"severity"`
Description string `json:"description"`
Timestamp int64 `json:"timestamp"`
Score float64 `json:"score"`
}
AnomalyInfo represents a detected anomaly.
type AttributeEntry ¶
type AttributeEntry struct {
Key string `json:"key"`
Value string `json:"value"`
Count int64 `json:"count"`
Percentage float64 `json:"percentage"`
}
AttributeEntry represents a single top attribute key+value with count.
type ClassItem ¶
type ClassItem struct {
Name string `json:"name"`
Count int `json:"count"`
Percentage float64 `json:"percentage"`
}
ClassItem represents a log class/category.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the shared, concurrency-safe analysis state that the TUI and web dashboard read from. The processing pipeline writes via Ingest(); all Query*/Get* methods acquire a read lock.
func NewEngine ¶
func NewEngine(maxLogBuffer int, stopWords map[string]bool, aiClient ai.Client, useLogTime bool) *Engine
NewEngine creates a new Engine with the given configuration.
func (*Engine) GetAllLogEntries ¶
GetAllLogEntries returns a copy of all log entries.
func (*Engine) GetAnomalies ¶
GetAnomalies detects anomalies in the log data.
func (*Engine) GetCountsHistory ¶
func (e *Engine) GetCountsHistory() []tui.SeverityCounts
GetCountsHistory returns a copy of the counts history.
func (*Engine) GetDrain3BySeverity ¶
func (e *Engine) GetDrain3BySeverity() map[string]*tui.Drain3Manager
GetDrain3BySeverity returns the drain3 map (not a copy — callers should not modify).
func (*Engine) GetFrequencySnapshot ¶
func (e *Engine) GetFrequencySnapshot() *memory.FrequencySnapshot
GetFrequencySnapshot returns the latest frequency snapshot.
func (*Engine) GetHeatmapData ¶
func (e *Engine) GetHeatmapData() []tui.HeatmapMinute
GetHeatmapData returns a copy of heatmap data.
func (*Engine) GetLifetimeAttrCounts ¶
GetLifetimeAttrCounts returns a copy of lifetime attribute counts.
func (*Engine) GetLifetimeAttrKeyCounts ¶
GetLifetimeAttrKeyCounts returns a copy of per-key attribute value counts.
func (*Engine) GetLifetimeHostCounts ¶
GetLifetimeHostCounts returns a copy of lifetime host counts.
func (*Engine) GetLifetimeServiceCounts ¶
GetLifetimeServiceCounts returns a copy of lifetime service counts.
func (*Engine) GetLifetimeSeverityCounts ¶
GetLifetimeSeverityCounts returns a copy of lifetime severity counts.
func (*Engine) GetLifetimeWordCounts ¶
GetLifetimeWordCounts returns a copy of lifetime word counts.
func (*Engine) GetLogEntryCount ¶
GetLogEntryCount returns the number of log entries in the buffer.
func (*Engine) GetSentimentHeatmap ¶
GetSentimentHeatmap returns an ASCII heatmap of sentiment over time.
func (*Engine) GetServicesBySeverity ¶
func (e *Engine) GetServicesBySeverity() map[string][]tui.ServiceCount
GetServicesBySeverity returns the services map.
func (*Engine) GetSeverityTimeSeries ¶
func (e *Engine) GetSeverityTimeSeries() []SeverityTimePoint
GetSeverityTimeSeries returns timestamped per-second severity counts. When no filters are provided, returns the pre-aggregated global series. When filters are present (e.g. search), builds the series from filtered log entries.
func (*Engine) GetStats ¶
func (e *Engine) GetStats() EngineStats
GetStats returns engine statistics.
func (*Engine) GetStreams ¶
func (e *Engine) GetStreams() []StreamInfo
GetStreams returns all tracked streams.
func (*Engine) Ingest ¶
Ingest adds a new log entry to the engine. Called from the processing pipeline. This is the only write path — it acquires a write lock.
func (*Engine) IngestSeverityCounts ¶
func (e *Engine) IngestSeverityCounts(counts tui.SeverityCounts)
IngestSeverityCounts adds interval-level severity counts to history.
func (*Engine) MarkStreamInactive ¶
MarkStreamInactive marks a stream as inactive (e.g., file reader finished).
func (*Engine) QueryClasses ¶
QueryClasses returns log classification distribution.
func (*Engine) QueryInsightsParams ¶
func (e *Engine) QueryInsightsParams(_ context.Context, _ InsightsFilters) (*InsightsParams, error)
QueryInsightsParams returns available filter dimension values.
func (*Engine) QueryLogSamples ¶
QueryLogSamples returns log entries matching the given filters.
func (*Engine) QueryPatterns ¶
func (e *Engine) QueryPatterns(_ context.Context, filters InsightsFilters) ([]PatternGroup, error)
QueryPatterns returns drain3 patterns grouped by the specified dimension.
func (*Engine) QuerySentimentData ¶
func (e *Engine) QuerySentimentData(_ context.Context, filters InsightsFilters) (*SentimentData, error)
QuerySentimentData returns sentiment distribution derived from severity.
func (*Engine) QuerySeverityData ¶
func (e *Engine) QuerySeverityData(_ context.Context, filters InsightsFilters) ([]SeverityGroup, error)
QuerySeverityData returns severity distribution grouped by the specified dimension.
func (*Engine) QuerySeverityTimeSeries ¶
func (e *Engine) QuerySeverityTimeSeries(_ context.Context, filters InsightsFilters) []SeverityTimePoint
QuerySeverityTimeSeries returns per-second severity counts filtered by the given filters. This recomputes the time series from raw log entries to support search/stream filtering.
func (*Engine) QuerySummary ¶
QuerySummary returns an AI-generated summary of the logs.
func (*Engine) RegisterStream ¶
RegisterStream explicitly registers a stream (called at startup for known inputs).
func (*Engine) UpdateFrequencySnapshot ¶
func (e *Engine) UpdateFrequencySnapshot(snapshot *memory.FrequencySnapshot)
UpdateFrequencySnapshot updates the latest frequency snapshot.
type EngineStats ¶
type EngineStats struct {
StartTime time.Time `json:"start_time"`
TotalLogsEver int `json:"total_logs_ever"`
TotalBytes int64 `json:"total_bytes"`
BufferSize int `json:"buffer_size"`
BufferUsed int `json:"buffer_used"`
}
EngineStats holds engine-level statistics.
type HeatmapMinuteData ¶
type HeatmapMinuteData struct {
Timestamp int64 `json:"timestamp"`
Counts map[string]int `json:"counts"`
}
HeatmapMinuteData represents one minute of heatmap data.
type InsightsFilters ¶
type InsightsFilters struct {
Start *int64 `json:"start,omitempty"`
End *int64 `json:"end,omitempty"`
GroupBy string `json:"group_by,omitempty"`
Environments *[]string `json:"environments,omitempty"`
Clusters *[]string `json:"clusters,omitempty"`
Namespaces *[]string `json:"namespaces,omitempty"`
Deployments *[]string `json:"deployments,omitempty"`
Pods *[]string `json:"pods,omitempty"`
Hosts *[]string `json:"hosts,omitempty"`
Services *[]string `json:"services,omitempty"`
Search *string `json:"search,omitempty"`
Severity *string `json:"severity,omitempty"`
Limit *int `json:"limit,omitempty"`
}
InsightsFilters defines filters for querying log analysis data. For local Gonzo, time range filters apply to the in-memory log buffer. Dimension filters (environments, namespaces, etc.) map to log entry attributes.
type InsightsParams ¶
type InsightsParams struct {
Environments []string `json:"environments,omitempty"`
Clusters []string `json:"clusters,omitempty"`
Namespaces []string `json:"namespaces,omitempty"`
Deployments []string `json:"deployments,omitempty"`
Pods []string `json:"pods,omitempty"`
Hosts []string `json:"hosts,omitempty"`
Services []string `json:"services,omitempty"`
Severities []string `json:"severities,omitempty"`
Categories []string `json:"categories,omitempty"`
TotalLogs int64 `json:"total_logs"`
OldestLog *int64 `json:"oldest_log,omitempty"`
NewestLog *int64 `json:"newest_log,omitempty"`
}
InsightsParams describes available filter dimension values.
type LogSample ¶
type LogSample struct {
Timestamp int64 `json:"timestamp"`
Severity string `json:"severity"`
Message string `json:"message"`
Attributes map[string]string `json:"attributes,omitempty"`
RawLine string `json:"raw_line,omitempty"`
}
LogSample is a single log entry for API responses.
type PatternGroup ¶
type PatternGroup struct {
GroupValue string `json:"group_value"`
Patterns []PatternItem `json:"patterns"`
}
PatternGroup represents patterns for one group_by value.
type PatternItem ¶
type PatternItem struct {
Pattern string `json:"pattern"`
Count int `json:"count"`
Percentage float64 `json:"percentage"`
Sample string `json:"sample,omitempty"`
}
PatternItem represents a single log pattern.
type SentimentBucket ¶
type SentimentBucket struct {
Timestamp int64 `json:"timestamp"`
GroupValue string `json:"group_value"`
Sentiment float64 `json:"sentiment"`
IsAnomaly bool `json:"is_anomaly,omitempty"`
LogCount int `json:"log_count"`
}
SentimentBucket represents one time bucket of sentiment data for a group.
type SentimentData ¶
type SentimentData struct {
GroupValues []string `json:"group_values"`
Buckets []SentimentBucket `json:"buckets"`
}
SentimentData is the response format for sentiment queries.
type SeverityGroup ¶
type SeverityGroup struct {
GroupValue string `json:"group_value"`
Counts map[string]int `json:"counts"`
Total int `json:"total"`
}
SeverityGroup represents severity distribution for one group_by value.
type SeverityTimePoint ¶
type SeverityTimePoint struct {
Timestamp int64 `json:"timestamp"`
Counts map[string]int `json:"counts"`
Total int `json:"total"`
}
SeverityTimePoint represents severity counts at a point in time (1-second interval).
type StatusInfo ¶
type StatusInfo struct {
Uptime string `json:"uptime"`
TotalLogs int64 `json:"total_logs"`
TotalBytes int64 `json:"total_bytes"`
LogRate float64 `json:"log_rate"`
Streams []StreamInfo `json:"streams"`
BufferSize int `json:"buffer_size"`
BufferUsed int `json:"buffer_used"`
AIConfigured bool `json:"ai_configured"`
}
StatusInfo represents server status.