Documentation
¶
Overview ¶
Copyright 2026 Google LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func Register(registry coreinspection.InspectionTaskRegistry) error
- type CSMAccessLogListLogEntryTaskSetting
- func (c *CSMAccessLogListLogEntryTaskSetting) DefaultResourceNames(ctx context.Context) ([]string, error)
- func (c *CSMAccessLogListLogEntryTaskSetting) Dependencies() []taskid.UntypedTaskReference
- func (c *CSMAccessLogListLogEntryTaskSetting) Description() *googlecloudcommon_contract.ListLogEntriesTaskDescription
- func (c *CSMAccessLogListLogEntryTaskSetting) LogFilters(ctx context.Context, taskMode inspectioncore_contract.InspectionTaskModeType) ([]string, error)
- func (c *CSMAccessLogListLogEntryTaskSetting) TaskID() taskid.TaskImplementationID[[]*log.Log]
- func (c *CSMAccessLogListLogEntryTaskSetting) TimePartitionCount(ctx context.Context) (int, error)
- type CSMAccessLogLogIngester
- type CSMAccessLogLogToTimelineMapper
- func (m *CSMAccessLogLogToTimelineMapper) Dependencies() []taskid.UntypedTaskReference
- func (m *CSMAccessLogLogToTimelineMapper) GroupedLogTask() taskid.TaskReference[inspectiontaskbase.LogGroupMap]
- func (m *CSMAccessLogLogToTimelineMapper) LogIngesterTask() taskid.TaskReference[[]*log.Log]
- func (m *CSMAccessLogLogToTimelineMapper) ProcessLogByGroup(ctx context.Context, l *log.Log, _ struct{}) (*khifilev6.TimelineChangeSet, struct{}, error)
- type CSMTrafficDirectorListLogEntryTaskSetting
- func (s *CSMTrafficDirectorListLogEntryTaskSetting) DefaultResourceNames(ctx context.Context) ([]string, error)
- func (s *CSMTrafficDirectorListLogEntryTaskSetting) Dependencies() []taskid.UntypedTaskReference
- func (s *CSMTrafficDirectorListLogEntryTaskSetting) Description() *googlecloudcommon_contract.ListLogEntriesTaskDescription
- func (s *CSMTrafficDirectorListLogEntryTaskSetting) LogFilters(ctx context.Context, taskMode inspectioncore_contract.InspectionTaskModeType) ([]string, error)
- func (s *CSMTrafficDirectorListLogEntryTaskSetting) TaskID() taskid.TaskImplementationID[[]*log.Log]
- func (s *CSMTrafficDirectorListLogEntryTaskSetting) TimePartitionCount(ctx context.Context) (int, error)
- type CSMTrafficDirectorLogToTimelineMapper
- func (m *CSMTrafficDirectorLogToTimelineMapper) Dependencies() []taskid.UntypedTaskReference
- func (m *CSMTrafficDirectorLogToTimelineMapper) GroupedLogTask() taskid.TaskReference[inspectiontaskbase.LogGroupMap]
- func (m *CSMTrafficDirectorLogToTimelineMapper) LogIngesterTask() taskid.TaskReference[[]*log.Log]
- func (m *CSMTrafficDirectorLogToTimelineMapper) ProcessLogByGroup(ctx context.Context, l *log.Log, ...) (*khifilev6.TimelineChangeSet, *googlecloudcommon_contract.GCPOperationTracker, ...)
Constants ¶
This section is empty.
Variables ¶
var CSMClusterIdentifierTask = coretask.NewTask( googlecloudlogcsm_contract.CSMClusterIdentifierTaskID, []taskid.UntypedTaskReference{googlecloudk8scommon_contract.NEGToBackendServiceInventoryTaskID.Ref()}, func(ctx context.Context) ([]string, error) { inventory := coretask.GetTaskResult(ctx, googlecloudk8scommon_contract.NEGToBackendServiceInventoryTaskID.Ref()) uniqueIds := make(map[string]struct{}) for _, bsName := range inventory { if strings.HasPrefix(bsName, "gsmrsvd-") { parts := strings.Split(bsName, "-") if len(parts) >= 3 { uniqueIds[parts[1]] = struct{}{} } } } result := make([]string, 0, len(uniqueIds)) for id := range uniqueIds { result = append(result, id) } return result, nil }, )
CSMClusterIdentifierTask extracts the unique cluster identifier(s) from BackendService names. CSM BackendService names follow the pattern: gsmrsvd-(cluster-identifier)-(neg-id).
var CSMTrafficDirectorFieldSetReaderTask = inspectiontaskbase.NewFieldSetReadTask( googlecloudlogcsm_contract.CSMTrafficDirectorFieldSetReaderTaskID, googlecloudlogcsm_contract.ListCSMTrafficDirectorLogEntriesTaskID.Ref(), []log.FieldSetReader{ &googlecloudcommon_contract.GCPOperationAuditLogFieldSetReader{}, &googlecloudcommon_contract.GCPDefaultSeverityFieldSetReader{}, }, )
CSMTrafficDirectorFieldSetReaderTask is a task that reads and parses field sets from CSM Traffic Director logs.
var CSMTrafficDirectorLogGrouperTask = inspectiontaskbase.NewLogGrouperTask( googlecloudlogcsm_contract.CSMTrafficDirectorLogGrouperTaskID, googlecloudlogcsm_contract.CSMTrafficDirectorFieldSetReaderTaskID.Ref(), func(ctx context.Context, l *log.Log) string { audit, err := log.GetFieldSet(l, &googlecloudcommon_contract.GCPAuditLogFieldSet{}) if err != nil { return "unknown" } return audit.ResourceName }, )
CSMTrafficDirectorLogGrouperTask is a task that groups CSM Traffic Director logs by their resource name.
var CSMTrafficDirectorLogIngesterTask = googlecloudcommon_contract.NewGCPOperationLogIngesterTask( googlecloudlogcsm_contract.CSMTrafficDirectorLogIngesterTaskID, googlecloudlogcsm_contract.CSMTrafficDirectorFieldSetReaderTaskID.Ref(), googlecloudlogcsm_contract.LogTypeCSMAccessLog, )
CSMTrafficDirectorLogIngesterTask is a task that ingests CSM Traffic Director logs.
var CSMTrafficDirectorLogToTimelineMapperTask = inspectiontaskbase.NewLogToTimelineMapperTaskV2( googlecloudlogcsm_contract.CSMTrafficDirectorLogToTimelineMapperTaskID, &CSMTrafficDirectorLogToTimelineMapper{}, inspectioncore_contract.FeatureTaskLabelV2( "CSM Resource Audit Logs", "Gather audit logs for Traffic Director resources created by the TD-based CSM to map them to timelines alongside associated Kubernetes resource logs.", 10100, false, ), )
CSMTrafficDirectorLogToTimelineMapperTask maps CSM Traffic Director logs to timelines.
var ClusterIdentityAliasTask = coretask.NewAliasTask( googlecloudlogcsm_contract.ClusterIdentityTaskID, googlecloudk8scommon_contract.ClusterIdentityTaskID.Ref(), )
var FieldSetReaderTask = inspectiontaskbase.NewFieldSetReadTask(googlecloudlogcsm_contract.FieldSetReaderTaskID, googlecloudlogcsm_contract.ListLogEntriesTaskID.Ref(), []log.FieldSetReader{ &googlecloudcommon_contract.GCPAccessLogFieldSetReader{}, &googlecloudlogcsm_contract.IstioAccessLogFieldSetReader{}, &googlecloudcommon_contract.GCPDefaultSeverityFieldSetReader{}, })
FieldSetReaderTask is a task that reads CSM access logs field sets.
var InputCSMResponseFlagsTask = formtask.NewSetFormTaskBuilder(googlecloudlogcsm_contract.InputCSMResponseFlagsTaskID, priorityForCSMGroup+1000, "Envoy response flags"). WithDefaultValueConstant([]string{"@any", "-OK"}, true). WithAllowAddAll(false). WithAllowRemoveAll(false). WithAllowCustomValue(true). WithDescription("Response flags used for filtering CSM access logs. Note '-' in response flags is corresponded to 'OK' in this form."). WithOptionsFunc(func(ctx context.Context, previousValues []string) ([]inspectionmetadata.SetParameterFormFieldOptionItem, error) { result := []inspectionmetadata.SetParameterFormFieldOptionItem{ {ID: "@any", Description: "[Alias] Matches any response flag"}, } ids := make([]string, 0, len(googlecloudlogcsm_contract.HumanReadableErrorMessage)) for flag := range googlecloudlogcsm_contract.HumanReadableErrorMessage { ids = append(ids, string(flag)) } sort.Strings(ids) for _, id := range ids { message := googlecloudlogcsm_contract.HumanReadableErrorMessage[googlecloudlogcsm_contract.ResponseFlag(id)] if id == "-" { id = "OK" message = "It's '-' in the response flag field because '-' means subtracting operator in this form." } result = append(result, inspectionmetadata.SetParameterFormFieldOptionItem{ID: id, Description: message}) } return result, nil }). WithValidator(func(ctx context.Context, value []string) (string, error) { strFilter := strings.Join(value, " ") result, err := gcpqueryutil.ParseSetFilter(strFilter, inputCSMAliasMap, true, true, true) if err != nil { return "", err } if result.ValidationError == "" { err = verifyResponseFlags(convertInputOnlyResponseFlagToActualFlag(result.Additives)) if err != nil { return err.Error(), nil } err = verifyResponseFlags(convertInputOnlyResponseFlagToActualFlag(result.Subtractives)) if err != nil { return err.Error(), nil } } return result.ValidationError, nil }). WithConverter(func(ctx context.Context, value []string) (*gcpqueryutil.SetFilterParseResult, error) { strFilter := strings.Join(value, " ") result, err := gcpqueryutil.ParseSetFilter(strFilter, inputCSMAliasMap, true, true, true) if err != nil { return nil, err } result.Additives = convertInputOnlyResponseFlagToActualFlag(result.Additives) result.Subtractives = convertInputOnlyResponseFlagToActualFlag(result.Subtractives) return result, nil }). Build()
var InputFleetProjectIDTask = formtask.NewTextFormTaskBuilder(googlecloudlogcsm_contract.InputFleetProjectIDTaskID, priorityForCSMGroup+500, "Fleet project ID"). WithDependencies([]taskid.UntypedTaskReference{ googlecloudlogcsm_contract.ClusterIdentityTaskID.Ref(), }). WithDescription("The project ID where the Fleet is hosted and CSM control plane logs are stored. Default is the cluster's project ID."). WithDefaultValueFunc(func(ctx context.Context, previousValues []string) (string, error) { if len(previousValues) > 0 { return previousValues[0], nil } cluster := coretask.GetTaskResult(ctx, googlecloudlogcsm_contract.ClusterIdentityTaskID.Ref()) return cluster.ProjectID, nil }). Build()
var ListCSMTrafficDirectorLogEntriesTask = googlecloudcommon_contract.NewListLogEntriesTask(&CSMTrafficDirectorListLogEntryTaskSetting{})
var ListLogEntriesTask = googlecloudcommon_contract.NewListLogEntriesTask(&CSMAccessLogListLogEntryTaskSetting{})
var LogGrouperTask = inspectiontaskbase.NewLogGrouperTask(googlecloudlogcsm_contract.LogGrouperTaskID, googlecloudlogcsm_contract.FieldSetReaderTaskID.Ref(), func(ctx context.Context, l *log.Log) string { istioAccessLogFieldSet := log.MustGetFieldSet(l, &googlecloudlogcsm_contract.IstioAccessLogFieldSet{}) return fmt.Sprintf("%s-%s", istioAccessLogFieldSet.ReporterPodNamespace, istioAccessLogFieldSet.ReporterPodName) }, )
LogGrouperTask groups CSM access logs by their reporter pod.
var LogIngesterTask = inspectiontaskbase.NewLogIngesterTaskV2( googlecloudlogcsm_contract.LogIngesterTaskID, &CSMAccessLogLogIngester{}, )
LogIngesterTask is the task that executes CSMAccessLogLogIngester.
var LogToTimelineMapperTask = inspectiontaskbase.NewLogToTimelineMapperTaskV2( googlecloudlogcsm_contract.LogToTimelineMapperTaskID, &CSMAccessLogLogToTimelineMapper{}, inspectioncore_contract.FeatureTaskLabelV2( "CSM Access Logs", "Gather CSM access logs to visualize network traffic flows and latency under client or server Pod timelines.", 10000, false, ), )
LogToTimelineMapperTask maps CSM access logs to timelines.
Functions ¶
func Register ¶
func Register(registry coreinspection.InspectionTaskRegistry) error
graph TD subgraph "CSM Access Log" direction LR InputCSMResponseFlagsTask(Input CSM Response Flags) ListLogEntriesTask(List Log Entries) FieldSetReaderTask(Field Set Reader) LogIngesterTask(Log Serializer) LogGrouperTask(Log Grouper) LogToTimelineMapperTask(TimelineMapper) ListLogEntriesTask --> FieldSetReaderTask ListLogEntriesTask --> LogIngesterTask FieldSetReaderTask --> LogGrouperTask LogGrouperTask --> LogToTimelineMapperTask LogIngesterTask --> LogToTimelineMapperTask InputCSMResponseFlagsTask --> ListLogEntriesTask end
Register registers all googlecloudlogcsm inspection tasks to the registry.
Types ¶
type CSMAccessLogListLogEntryTaskSetting ¶
type CSMAccessLogListLogEntryTaskSetting struct{}
func (*CSMAccessLogListLogEntryTaskSetting) DefaultResourceNames ¶
func (c *CSMAccessLogListLogEntryTaskSetting) DefaultResourceNames(ctx context.Context) ([]string, error)
DefaultResourceNames implements googlecloudcommon_contract.ListLogEntriesTaskSetting.
func (*CSMAccessLogListLogEntryTaskSetting) Dependencies ¶
func (c *CSMAccessLogListLogEntryTaskSetting) Dependencies() []taskid.UntypedTaskReference
Dependencies implements googlecloudcommon_contract.ListLogEntriesTaskSetting.
func (*CSMAccessLogListLogEntryTaskSetting) Description ¶
func (c *CSMAccessLogListLogEntryTaskSetting) Description() *googlecloudcommon_contract.ListLogEntriesTaskDescription
Description implements googlecloudcommon_contract.ListLogEntriesTaskSetting.
func (*CSMAccessLogListLogEntryTaskSetting) LogFilters ¶
func (c *CSMAccessLogListLogEntryTaskSetting) LogFilters(ctx context.Context, taskMode inspectioncore_contract.InspectionTaskModeType) ([]string, error)
LogFilters implements googlecloudcommon_contract.ListLogEntriesTaskSetting.
func (*CSMAccessLogListLogEntryTaskSetting) TaskID ¶
func (c *CSMAccessLogListLogEntryTaskSetting) TaskID() taskid.TaskImplementationID[[]*log.Log]
TaskID implements googlecloudcommon_contract.ListLogEntriesTaskSetting.
func (*CSMAccessLogListLogEntryTaskSetting) TimePartitionCount ¶
func (c *CSMAccessLogListLogEntryTaskSetting) TimePartitionCount(ctx context.Context) (int, error)
TimePartitionCount implements googlecloudcommon_contract.ListLogEntriesTaskSetting.
type CSMAccessLogLogIngester ¶ added in v0.56.0
type CSMAccessLogLogIngester struct{}
CSMAccessLogLogIngester ingests CSM access logs.
func (*CSMAccessLogLogIngester) Dependencies ¶ added in v0.56.0
func (i *CSMAccessLogLogIngester) Dependencies() []taskid.UntypedTaskReference
Dependencies returns the task dependencies.
func (*CSMAccessLogLogIngester) ProcessLog ¶ added in v0.56.0
func (i *CSMAccessLogLogIngester) ProcessLog(ctx context.Context, l *log.Log) (*khifilev6.LogChangeSet, error)
ProcessLog parses raw log entry and populates the LogChangeSet.
func (*CSMAccessLogLogIngester) RawLogTask ¶ added in v0.56.0
func (i *CSMAccessLogLogIngester) RawLogTask() taskid.TaskReference[[]*log.Log]
RawLogTask returns the task reference that provides raw logs.
type CSMAccessLogLogToTimelineMapper ¶ added in v0.56.0
type CSMAccessLogLogToTimelineMapper struct {
inspectiontaskbase.StatelessMapperBase
}
CSMAccessLogLogToTimelineMapper maps CSM access logs to resource timelines.
func (*CSMAccessLogLogToTimelineMapper) Dependencies ¶ added in v0.56.0
func (m *CSMAccessLogLogToTimelineMapper) Dependencies() []taskid.UntypedTaskReference
Dependencies returns additional task dependencies.
func (*CSMAccessLogLogToTimelineMapper) GroupedLogTask ¶ added in v0.56.0
func (m *CSMAccessLogLogToTimelineMapper) GroupedLogTask() taskid.TaskReference[inspectiontaskbase.LogGroupMap]
GroupedLogTask returns a reference to the task that provides the grouped logs.
func (*CSMAccessLogLogToTimelineMapper) LogIngesterTask ¶ added in v0.56.0
func (m *CSMAccessLogLogToTimelineMapper) LogIngesterTask() taskid.TaskReference[[]*log.Log]
LogIngesterTask returns a reference to the task that provides ingested logs.
func (*CSMAccessLogLogToTimelineMapper) ProcessLogByGroup ¶ added in v0.56.0
func (m *CSMAccessLogLogToTimelineMapper) ProcessLogByGroup(ctx context.Context, l *log.Log, _ struct{}) (*khifilev6.TimelineChangeSet, struct{}, error)
ProcessLogByGroup maps each log inside a group to one or more timeline events.
type CSMTrafficDirectorListLogEntryTaskSetting ¶ added in v0.54.0
type CSMTrafficDirectorListLogEntryTaskSetting struct{}
func (*CSMTrafficDirectorListLogEntryTaskSetting) DefaultResourceNames ¶ added in v0.54.0
func (s *CSMTrafficDirectorListLogEntryTaskSetting) DefaultResourceNames(ctx context.Context) ([]string, error)
DefaultResourceNames implements googlecloudcommon_contract.ListLogEntriesTaskSetting.
func (*CSMTrafficDirectorListLogEntryTaskSetting) Dependencies ¶ added in v0.54.0
func (s *CSMTrafficDirectorListLogEntryTaskSetting) Dependencies() []taskid.UntypedTaskReference
Dependencies implements googlecloudcommon_contract.ListLogEntriesTaskSetting.
func (*CSMTrafficDirectorListLogEntryTaskSetting) Description ¶ added in v0.54.0
func (s *CSMTrafficDirectorListLogEntryTaskSetting) Description() *googlecloudcommon_contract.ListLogEntriesTaskDescription
Description implements googlecloudcommon_contract.ListLogEntriesTaskSetting.
func (*CSMTrafficDirectorListLogEntryTaskSetting) LogFilters ¶ added in v0.54.0
func (s *CSMTrafficDirectorListLogEntryTaskSetting) LogFilters(ctx context.Context, taskMode inspectioncore_contract.InspectionTaskModeType) ([]string, error)
LogFilters implements googlecloudcommon_contract.ListLogEntriesTaskSetting.
func (*CSMTrafficDirectorListLogEntryTaskSetting) TaskID ¶ added in v0.54.0
func (s *CSMTrafficDirectorListLogEntryTaskSetting) TaskID() taskid.TaskImplementationID[[]*log.Log]
TaskID implements googlecloudcommon_contract.ListLogEntriesTaskSetting.
func (*CSMTrafficDirectorListLogEntryTaskSetting) TimePartitionCount ¶ added in v0.54.0
func (s *CSMTrafficDirectorListLogEntryTaskSetting) TimePartitionCount(ctx context.Context) (int, error)
TimePartitionCount implements googlecloudcommon_contract.ListLogEntriesTaskSetting.
type CSMTrafficDirectorLogToTimelineMapper ¶ added in v0.56.0
type CSMTrafficDirectorLogToTimelineMapper struct {
inspectiontaskbase.SinglePassMapperBase[*googlecloudcommon_contract.GCPOperationTracker]
}
CSMTrafficDirectorLogToTimelineMapper maps CSM Traffic Director logs to resource timelines.
func (*CSMTrafficDirectorLogToTimelineMapper) Dependencies ¶ added in v0.56.0
func (m *CSMTrafficDirectorLogToTimelineMapper) Dependencies() []taskid.UntypedTaskReference
Dependencies returns additional task dependencies.
func (*CSMTrafficDirectorLogToTimelineMapper) GroupedLogTask ¶ added in v0.56.0
func (m *CSMTrafficDirectorLogToTimelineMapper) GroupedLogTask() taskid.TaskReference[inspectiontaskbase.LogGroupMap]
GroupedLogTask returns a reference to the task that provides the grouped logs.
func (*CSMTrafficDirectorLogToTimelineMapper) LogIngesterTask ¶ added in v0.56.0
func (m *CSMTrafficDirectorLogToTimelineMapper) LogIngesterTask() taskid.TaskReference[[]*log.Log]
LogIngesterTask returns a reference to the task that provides ingested logs.
func (*CSMTrafficDirectorLogToTimelineMapper) ProcessLogByGroup ¶ added in v0.56.0
func (m *CSMTrafficDirectorLogToTimelineMapper) ProcessLogByGroup(ctx context.Context, l *log.Log, tracker *googlecloudcommon_contract.GCPOperationTracker) (*khifilev6.TimelineChangeSet, *googlecloudcommon_contract.GCPOperationTracker, error)
ProcessLogByGroup maps each log inside a group to one or more timeline events or revisions.