googlecloudlogcsm_impl

package
v0.52.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 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 substracting 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 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)
	},
)
View Source
var LogToTimelineMapperTask = inspectiontaskbase.NewLogToTimelineMapperTask[struct{}](googlecloudlogcsm_contract.LogToTimelineMapperTaskID, &csmAccessLogLogToTimelineMapperSetting{}, inspectioncore_contract.FeatureTaskLabel(
	"CSM Access Log",
	"Gather CSM access logs from Cloud Logging and associate them in client or server Pods on timelines",
	enum.LogTypeCSMAccessLog,
	10000,
	false,
	googlecloudinspectiontypegroup_contract.GCPK8sClusterInspectionTypes...,
))

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

Dependencies implements googlecloudcommon_contract.ListLogEntriesTaskSetting.

func (*CSMAccessLogListLogEntryTaskSetting) Description

Description implements googlecloudcommon_contract.ListLogEntriesTaskSetting.

func (*CSMAccessLogListLogEntryTaskSetting) LogFilters

LogFilters implements googlecloudcommon_contract.ListLogEntriesTaskSetting.

func (*CSMAccessLogListLogEntryTaskSetting) TaskID

TaskID implements googlecloudcommon_contract.ListLogEntriesTaskSetting.

func (*CSMAccessLogListLogEntryTaskSetting) TimePartitionCount

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

TimePartitionCount implements googlecloudcommon_contract.ListLogEntriesTaskSetting.

Jump to

Keyboard shortcuts

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