/**
 * Log Search & Analysis
 *
 * Specialized search functionality for log entries with
 * level filtering, time range queries, and pattern detection.
 *
 * @since v1.68.0
 */
import { type SearchEngine } from './search-engine.js';
import type { SearchResult } from './search-types.js';
/**
 * Log levels
 */
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'fatal';
/**
 * Log level priorities (higher = more severe)
 */
export declare const LOG_LEVEL_PRIORITY: Record<LogLevel, number>;
/**
 * Log level colors for display
 */
export declare const LOG_LEVEL_COLORS: Record<LogLevel, string>;
/**
 * A log entry for indexing
 */
export interface LogEntry {
    /** Unique log ID */
    id: string;
    /** Log level */
    level: LogLevel;
    /** Log message */
    message: string;
    /** Timestamp */
    timestamp: number;
    /** Source (plugin name, system, etc.) */
    source?: string;
    /** Additional context/metadata */
    context?: Record<string, unknown>;
    /** Stack trace if error */
    stackTrace?: string;
    /** Associated plugin ID */
    pluginId?: string;
    /** Server ID */
    serverId?: string;
}
/**
 * Log search options
 */
export interface LogSearchOptions {
    /** Text query */
    query?: string;
    /** Minimum log level */
    minLevel?: LogLevel;
    /** Maximum log level */
    maxLevel?: LogLevel;
    /** Start time */
    startTime?: number;
    /** End time */
    endTime?: number;
    /** Filter by source */
    source?: string;
    /** Filter by plugin ID */
    pluginId?: string;
    /** Filter by server ID */
    serverId?: string;
    /** Maximum results */
    limit?: number;
    /** Sort order */
    sortOrder?: 'asc' | 'desc';
}
/**
 * Log search result with enhanced metadata
 */
export interface LogSearchResult extends SearchResult {
    /** Original log entry */
    logEntry: LogEntry;
    /** Matched patterns if any */
    patterns?: string[];
}
/**
 * Log pattern for detection
 */
export interface LogPattern {
    /** Pattern ID */
    id: string;
    /** Pattern name */
    name: string;
    /** Regex pattern */
    pattern: RegExp;
    /** Severity level */
    severity: 'low' | 'medium' | 'high' | 'critical';
    /** Description */
    description: string;
    /** Suggested action */
    suggestedAction?: string;
}
/**
 * Common log patterns to detect
 */
export declare const COMMON_LOG_PATTERNS: LogPattern[];
/**
 * Log search service
 */
export declare class LogSearchService {
    private engine;
    private logs;
    private patterns;
    constructor(engine?: SearchEngine);
    /**
     * Add a log entry to the search index
     */
    addLog(entry: LogEntry): void;
    /**
     * Add multiple log entries
     */
    addLogs(entries: LogEntry[]): void;
    /**
     * Remove a log entry
     */
    removeLog(id: string): boolean;
    /**
     * Get a log entry by ID
     */
    getLog(id: string): LogEntry | undefined;
    /**
     * Search logs
     */
    search(options?: LogSearchOptions): LogSearchResult[];
    /**
     * Search logs by time range
     */
    searchByTimeRange(startTime: number | string, endTime: number | string, options?: Omit<LogSearchOptions, 'startTime' | 'endTime'>): LogSearchResult[];
    /**
     * Search logs by level
     */
    searchByLevel(level: LogLevel | LogLevel[], options?: Omit<LogSearchOptions, 'minLevel' | 'maxLevel'>): LogSearchResult[];
    /**
     * Get error summary for time period
     */
    getErrorSummary(startTime?: number, endTime?: number): {
        totalErrors: number;
        byLevel: Record<LogLevel, number>;
        bySource: Record<string, number>;
        topPatterns: Array<{
            pattern: LogPattern;
            count: number;
        }>;
    };
    /**
     * Detect patterns in a message
     */
    detectPatterns(message: string): LogPattern[];
    /**
     * Add a custom pattern
     */
    addPattern(pattern: LogPattern): void;
    /**
     * Remove a custom pattern
     */
    removePattern(id: string): boolean;
    /**
     * Get all patterns
     */
    getPatterns(): LogPattern[];
    /**
     * Get logs count by level
     */
    getCountByLevel(): Record<LogLevel, number>;
    /**
     * Get recent logs
     */
    getRecentLogs(limit?: number): LogEntry[];
    /**
     * Clear all logs
     */
    clear(): void;
    /**
     * Get total log count
     */
    count(): number;
    /**
     * Truncate message for title
     */
    private truncateMessage;
}
/**
 * Get the global log search service
 */
export declare function getLogSearchService(): LogSearchService;
/**
 * Reset the log search service
 */
export declare function resetLogSearchService(): void;
//# sourceMappingURL=log-search.d.ts.map