client_inventory

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	AuthTypeIAM             = "IAM"
	AuthTypeSASL_SCRAM      = "SASL_SCRAM"
	AuthTypeTLS             = "TLS"
	AuthTypeUNAUTHENTICATED = "UNAUTHENTICATED"
	AuthTypeUNKNOWN         = "UNKNOWN"
)

Variables

View Source
var (
	ErrorUnableToParseKafkaApiLine = errors.New("unable to parse Kafka API line")
	ErrorUnableToParseTimestamp    = errors.New("unable to parse timestamp")
	ErrorUnsupportedLogLine        = errors.New("unsupported log line")
)
View Source
var (
	TimestampPattern     = regexp.MustCompile(`^\[([^\]]+)\]`)
	ApiKeyPattern        = regexp.MustCompile(`apiKey=([^,\)]+)`)
	ClientIdPattern      = regexp.MustCompile(`clientId=([^,\)]+)`)
	BrokerFetcherPattern = regexp.MustCompile(`broker-(\d+)-fetcher-(\d+)`)

	ProducerTopicPattern = regexp.MustCompile(`partitionSizes=\[(.+)-\d+=`)
	ConsumerTopicPattern = regexp.MustCompile(`FetchTopic\(topic='([^']+)'`)

	// IAM-specific pattern to extract ARN
	IAMPrincipalArnPattern = regexp.MustCompile(`principal:\[IAM\]:\[(arn:aws:[^\]]+)\]:`)
	// SASL_SCRAM-specific pattern to extract User:username
	SASLSCRAMPrincipalPattern = regexp.MustCompile(`principal:(User:[^ ]+)`)
	// TLS pattern - extract User:CN= and any additional certificate info (requires SSL protocol)
	TLSPrincipalPattern = regexp.MustCompile(`securityProtocol:SSL,principal:(User:CN=[^(]+?)\s*\(`)
	// Anonymous pattern - detect unauthenticated requests with User:ANONYMOUS
	AnonymousPrincipalPattern = regexp.MustCompile(`principal:(User:ANONYMOUS)`)
)
View Source
var (
	// lines that match this pattern will be parsed by kafka trace line parser
	KafkaApiTracePattern = regexp.MustCompile(`^\[.*\] TRACE \[KafkaApi-\d+\].*\(kafka\.server\.KafkaApis\)$`)
)

Functions

func NewScanClientInventoryCmd

func NewScanClientInventoryCmd() *cobra.Command

Types

type ClientInventoryScanner

type ClientInventoryScanner struct {
	// contains filtered or unexported fields
}

func NewClientInventoryScanner

func NewClientInventoryScanner(s3Service S3Service, state types.State, opts ClientInventoryScannerOpts) (*ClientInventoryScanner, error)

func (*ClientInventoryScanner) Run

func (cis *ClientInventoryScanner) Run() error

type ClientInventoryScannerOpts

type ClientInventoryScannerOpts struct {
	S3Uri       string
	Region      string
	ClusterName string
	StateFile   string
}

type KafkaApiTraceLineParser

type KafkaApiTraceLineParser struct{}

func (*KafkaApiTraceLineParser) Parse

func (p *KafkaApiTraceLineParser) Parse(line string, lineNumber int, fileName string) (*RequestMetadata, error)

type RequestMetadata

type RequestMetadata struct {
	CompositeKey string
	ClientId     string
	Topic        string
	Role         string
	Principal    string
	Auth         string
	ApiKey       string
	Timestamp    time.Time
}

type S3Service

type S3Service interface {
	ParseS3URI(s3Uri string) (string, string, error)
	ListLogFiles(ctx context.Context, bucket, prefix string) ([]string, error)
	DownloadAndDecompressLogFile(ctx context.Context, bucket, key string) ([]byte, error)
}

Jump to

Keyboard shortcuts

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