export interface LogAnalyticsResourceConfig { id: string; name: string; workspaceId: string; active: boolean; apiKey?: string; description?: string; } export interface LogAnalyticsConfig { resources: LogAnalyticsResourceConfig[]; tenantId?: string; clientId?: string; clientSecret?: string; authMethod: 'entra-id' | 'api-key'; } export interface QueryResult { tables: { name: string; columns: { name: string; type: string; }[]; rows: any[][]; }[]; /** The timespan actually sent to the API (explicit, derived from ago(), or the PT1H default). */ effectiveTimespan?: string; /** Set when an explicit timespan clips a wider ago() window declared in the KQL. */ timespanWarning?: string; } export interface MetadataResult { tables: { name: string; columns: { name: string; type: string; description?: string; }[]; }[]; } export declare class LogAnalyticsService { private config; private msalClient; private accessToken; private tokenExpirationTime; private readonly baseUrl; constructor(config: LogAnalyticsConfig); /** * Get access token for Log Analytics API using Microsoft Entra ID OAuth * Implements token caching with 5-minute buffer before expiry */ private getAccessToken; /** * Get authorization headers based on authentication method */ private getAuthHeaders; /** * Execute a KQL query against a Log Analytics workspace */ executeQuery(resourceId: string, query: string, timespan?: string): Promise; /** * Get workspace metadata (schema) */ getMetadata(resourceId: string): Promise; /** * Test workspace access by executing a simple query */ testWorkspaceAccess(resourceId: string): Promise<{ success: boolean; message: string; details?: any; }>; /** * Get recent events from any table */ getRecentEvents(resourceId: string, tableName: string, timespan?: string, limit?: number): Promise; /** * Search logs across tables or specific table */ searchLogs(resourceId: string, searchText: string, tableName?: string, timespan?: string, limit?: number): Promise; /** * Get Azure Function logs from FunctionAppLogs table */ getFunctionLogs(resourceId: string, functionName?: string, timespan?: string, severityLevel?: number, limit?: number): Promise; /** * Get Azure Function errors */ getFunctionErrors(resourceId: string, functionName?: string, timespan?: string, limit?: number): Promise; /** * Get Azure Function execution statistics */ getFunctionStats(resourceId: string, functionName?: string, timespan?: string): Promise; /** * Get Azure Function invocations from traces or requests table */ getFunctionInvocations(resourceId: string, functionName?: string, timespan?: string, limit?: number): Promise; /** * Get all configured resources */ getAllResources(): LogAnalyticsResourceConfig[]; /** * Get only active resources */ getActiveResources(): LogAnalyticsResourceConfig[]; /** * Get resource by ID and validate it's active */ getResourceById(resourceId: string): LogAnalyticsResourceConfig; /** * Convert ISO 8601 duration to KQL timespan format * PT1H -> 1h, P1D -> 1d, PT30M -> 30m, etc. */ convertTimespanToKQL(iso8601Duration: string): string; /** * Validate KQL query (basic check) */ validateQuery(query: string): { valid: boolean; error?: string; }; } //# sourceMappingURL=log-analytics-service.d.ts.map