Documentation
¶
Index ¶
- Constants
- func BuildSafeKQLQuery(category, logLevel string, maxRecords int, clusterResourceID string, ...) (string, error)
- func CalculateTimespan(startTime, endTime string) (string, error)
- func ExtractWorkspaceGUIDFromDiagnosticSettings(subscriptionID, resourceGroup, clusterName string, ...) (string, error)
- func FindDiagnosticSettingForCategory(subscriptionID, resourceGroup, clusterName, logCategory string, ...) (string, bool, error)
- func GetControlPlaneDiagnosticSettingsHandler(azClient *azureclient.AzureClient, cfg *config.ConfigData) tools.ResourceHandler
- func GetControlPlaneLogsHandler(azClient *azureclient.AzureClient, cfg *config.ConfigData) tools.ResourceHandler
- func GetMaxRecords(params map[string]interface{}) int
- func HandleControlPlaneDiagnosticSettings(params map[string]interface{}, azClient *azureclient.AzureClient, ...) (string, error)
- func HandleControlPlaneLogs(params map[string]interface{}, azClient *azureclient.AzureClient, ...) (string, error)
- func ValidateControlPlaneLogsParams(params map[string]interface{}) error
- func ValidateKQLQueryParams(category, logLevel string, maxRecords int, clusterResourceID string, ...) error
- func ValidateTimeRange(startTime string, params map[string]interface{}) error
- type KQLQueryBuilder
- type LogLevelMapping
- type TableMode
Constants ¶
const ( MinMaxRecords = 1 MaxMaxRecords = 1000 DefaultKQLMaxRecords = 100 )
KQL query validation constants
const ( MaxLogRetentionDays = 7 MaxQueryRangeDuration = 24 * time.Hour DefaultMaxRecords = 100 MaxAllowedRecords = 1000 )
Constants for diagnostics configuration
Variables ¶
This section is empty.
Functions ¶
func BuildSafeKQLQuery ¶
func BuildSafeKQLQuery(category, logLevel string, maxRecords int, clusterResourceID string, isResourceSpecific bool) (string, error)
BuildSafeKQLQuery builds pre-validated KQL queries to prevent injection, scoped to specific AKS cluster Supports both Azure Diagnostics and Resource-specific destination tables Returns an error if query building fails
func CalculateTimespan ¶
CalculateTimespan converts start/end times to Azure CLI timespan format
func ExtractWorkspaceGUIDFromDiagnosticSettings ¶
func ExtractWorkspaceGUIDFromDiagnosticSettings(subscriptionID, resourceGroup, clusterName string, azClient *azureclient.AzureClient, cfg *config.ConfigData) (string, error)
ExtractWorkspaceGUIDFromDiagnosticSettings extracts workspace GUID from diagnostic settings
func FindDiagnosticSettingForCategory ¶
func FindDiagnosticSettingForCategory(subscriptionID, resourceGroup, clusterName, logCategory string, azClient *azureclient.AzureClient, cfg *config.ConfigData) (string, bool, error)
FindDiagnosticSettingForCategory finds the first diagnostic setting that has the specified log category enabled Returns the workspace ID and whether it uses resource-specific tables
func GetControlPlaneDiagnosticSettingsHandler ¶
func GetControlPlaneDiagnosticSettingsHandler(azClient *azureclient.AzureClient, cfg *config.ConfigData) tools.ResourceHandler
GetControlPlaneDiagnosticSettingsHandler returns handler for diagnostic settings tool
func GetControlPlaneLogsHandler ¶
func GetControlPlaneLogsHandler(azClient *azureclient.AzureClient, cfg *config.ConfigData) tools.ResourceHandler
GetControlPlaneLogsHandler returns handler for logs querying tool
func GetMaxRecords ¶
GetMaxRecords extracts and validates the max_records parameter
func HandleControlPlaneDiagnosticSettings ¶
func HandleControlPlaneDiagnosticSettings(params map[string]interface{}, azClient *azureclient.AzureClient, cfg *config.ConfigData) (string, error)
HandleControlPlaneDiagnosticSettings checks diagnostic settings for AKS cluster
func HandleControlPlaneLogs ¶
func HandleControlPlaneLogs(params map[string]interface{}, azClient *azureclient.AzureClient, cfg *config.ConfigData) (string, error)
HandleControlPlaneLogs queries specific control plane logs
func ValidateControlPlaneLogsParams ¶
ValidateControlPlaneLogsParams validates all parameters for control plane logs query
func ValidateKQLQueryParams ¶
func ValidateKQLQueryParams(category, logLevel string, maxRecords int, clusterResourceID string, tableMode TableMode) error
ValidateKQLQueryParams validates all parameters for KQL query builder
func ValidateTimeRange ¶
ValidateTimeRange validates start and end time parameters
Types ¶
type KQLQueryBuilder ¶
type KQLQueryBuilder struct {
// contains filtered or unexported fields
}
KQLQueryBuilder builds KQL queries for AKS control plane logs
func NewKQLQueryBuilder ¶
func NewKQLQueryBuilder(category, logLevel string, maxRecords int, clusterResourceID string, tableMode TableMode) (*KQLQueryBuilder, error)
NewKQLQueryBuilder creates a new KQL query builder instance
func (*KQLQueryBuilder) Build ¶
func (q *KQLQueryBuilder) Build() (string, error)
Build constructs the complete KQL query
type LogLevelMapping ¶
type LogLevelMapping struct { AzureDiagnosticsPrefix string // Prefix used in Azure Diagnostics log_s field ResourceSpecificLevel string // Level value used in resource-specific tables }
LogLevelMapping defines the mapping between log levels and their representations