googlecloudlogcsm_impl

package
v0.57.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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).

CSMTrafficDirectorFieldSetReaderTask is a task that reads and parses field sets from CSM Traffic Director logs.

CSMTrafficDirectorLogGrouperTask is a task that groups CSM Traffic Director logs by their resource name.

CSMTrafficDirectorLogIngesterTask is a task that ingests CSM Traffic Director logs.

View Source
var CSMTrafficDirectorLogToTimelineMapperTask = inspectiontaskbase.NewLogToTimelineMapperTask(
	googlecloudlogcsm_contract.CSMTrafficDirectorLogToTimelineMapperTaskID,
	&CSMTrafficDirectorLogToTimelineMapper{},
	inspectioncore_contract.FeatureTaskLabel(
		"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.

FieldSetReaderTask is a task that reads CSM traffic logs field sets.

View Source
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 traffic 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()
View Source
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()
View Source
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 traffic logs by their reporter pod.

LogIngesterTask is the task that executes CSMTrafficLogLogIngester.

View Source
var LogToTimelineMapperTask = inspectiontaskbase.NewLogToTimelineMapperTask(
	googlecloudlogcsm_contract.LogToTimelineMapperTaskID,
	&CSMTrafficLogLogToTimelineMapper{},
	inspectioncore_contract.FeatureTaskLabel(
		"CSM Traffic Logs",
		"Gather CSM traffic logs to visualize network traffic flows and latency under client or server Pod timelines.",
		10000,
		false,
	),
)

LogToTimelineMapperTask maps CSM traffic logs to timelines.

Functions

func Register

func Register(registry coreinspection.InspectionTaskRegistry) error
graph TD
 subgraph "CSM Traffic 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 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

Dependencies implements googlecloudcommon_contract.ListLogEntriesTaskSetting.

func (*CSMTrafficDirectorListLogEntryTaskSetting) Description added in v0.54.0

Description implements googlecloudcommon_contract.ListLogEntriesTaskSetting.

func (*CSMTrafficDirectorListLogEntryTaskSetting) LogFilters added in v0.54.0

LogFilters implements googlecloudcommon_contract.ListLogEntriesTaskSetting.

func (*CSMTrafficDirectorListLogEntryTaskSetting) TaskID added in v0.54.0

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

Dependencies returns additional task dependencies.

func (*CSMTrafficDirectorLogToTimelineMapper) GroupedLogTask added in v0.56.0

GroupedLogTask returns a reference to the task that provides the grouped logs.

func (*CSMTrafficDirectorLogToTimelineMapper) LogIngesterTask added in v0.56.0

LogIngesterTask returns a reference to the task that provides ingested logs.

func (*CSMTrafficDirectorLogToTimelineMapper) ProcessLogByGroup added in v0.56.0

ProcessLogByGroup maps each log inside a group to one or more timeline events or revisions.

type CSMTrafficLogListLogEntryTaskSetting added in v0.57.4

type CSMTrafficLogListLogEntryTaskSetting struct{}

func (*CSMTrafficLogListLogEntryTaskSetting) DefaultResourceNames added in v0.57.4

func (c *CSMTrafficLogListLogEntryTaskSetting) DefaultResourceNames(ctx context.Context) ([]string, error)

DefaultResourceNames implements googlecloudcommon_contract.ListLogEntriesTaskSetting.

func (*CSMTrafficLogListLogEntryTaskSetting) Dependencies added in v0.57.4

Dependencies implements googlecloudcommon_contract.ListLogEntriesTaskSetting.

func (*CSMTrafficLogListLogEntryTaskSetting) Description added in v0.57.4

Description implements googlecloudcommon_contract.ListLogEntriesTaskSetting.

func (*CSMTrafficLogListLogEntryTaskSetting) LogFilters added in v0.57.4

LogFilters implements googlecloudcommon_contract.ListLogEntriesTaskSetting.

func (*CSMTrafficLogListLogEntryTaskSetting) TaskID added in v0.57.4

TaskID implements googlecloudcommon_contract.ListLogEntriesTaskSetting.

func (*CSMTrafficLogListLogEntryTaskSetting) TimePartitionCount added in v0.57.4

func (c *CSMTrafficLogListLogEntryTaskSetting) TimePartitionCount(ctx context.Context) (int, error)

TimePartitionCount implements googlecloudcommon_contract.ListLogEntriesTaskSetting.

type CSMTrafficLogLogIngester added in v0.57.4

type CSMTrafficLogLogIngester struct{}

CSMTrafficLogLogIngester ingests CSM traffic logs.

func (*CSMTrafficLogLogIngester) Dependencies added in v0.57.4

Dependencies returns the task dependencies.

func (*CSMTrafficLogLogIngester) ProcessLog added in v0.57.4

ProcessLog parses raw log entry and populates the LogChangeSet.

func (*CSMTrafficLogLogIngester) RawLogTask added in v0.57.4

func (i *CSMTrafficLogLogIngester) RawLogTask() taskid.TaskReference[[]*log.Log]

RawLogTask returns the task reference that provides raw logs.

type CSMTrafficLogLogToTimelineMapper added in v0.57.4

type CSMTrafficLogLogToTimelineMapper struct {
	inspectiontaskbase.StatelessMapperBase
}

CSMTrafficLogLogToTimelineMapper maps CSM traffic logs to resource timelines.

func (*CSMTrafficLogLogToTimelineMapper) Dependencies added in v0.57.4

Dependencies returns additional task dependencies.

func (*CSMTrafficLogLogToTimelineMapper) GroupedLogTask added in v0.57.4

GroupedLogTask returns a reference to the task that provides the grouped logs.

func (*CSMTrafficLogLogToTimelineMapper) LogIngesterTask added in v0.57.4

func (m *CSMTrafficLogLogToTimelineMapper) LogIngesterTask() taskid.TaskReference[[]*log.Log]

LogIngesterTask returns a reference to the task that provides ingested logs.

func (*CSMTrafficLogLogToTimelineMapper) ProcessLogByGroup added in v0.57.4

func (m *CSMTrafficLogLogToTimelineMapper) 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL