gitlablogs

package
v1.10.0-RC1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package gitlablogs parses GitLab JSON logs.

Index

Constants

View Source
const (
	// PantherPrefix is the prefix of all logs parsed by this package
	PantherPrefix = "GitLab"
	// TypeAPI is the type of the GitLabAPI log record
	TypeAPI = PantherPrefix + ".API"
	// TypeAudit is the log type of Audit log records
	TypeAudit = PantherPrefix + ".Audit"
	// TypeExceptions is the log type of Exceptions log records
	TypeExceptions = PantherPrefix + ".Exceptions"
	// TypeGit is the log type of Git log records
	TypeGit = PantherPrefix + ".Git"
	// TypeIntegrations is the log type of GitLabIntegrations
	TypeIntegrations = PantherPrefix + ".Integrations"
	// TypeProduction is the type of the GitLabRails log record
	TypeProduction = PantherPrefix + ".Production"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Time                  *timestamp.RFC3339 `json:"time" validate:"required" description:"The request timestamp"`
	Severity              *string            `json:"severity" validate:"required" description:"The log level"`
	DurationSeconds       *float32           `json:"duration_s" validate:"required" description:"The time spent serving the request (in seconds)"`
	DBDurationSeconds     *float32           `json:"db_duration_s,omitempty" description:"The time spent quering the database (in seconds)"`
	ViewDurationSeconds   *float32           `json:"view_duration_s,omitempty" description:"The time spent rendering the view for the Rails controller (in seconds)"`
	Status                *int16             `json:"status" validate:"required" description:"The HTTP response status code"`
	Method                *string            `json:"method" validate:"required" description:"The HTTP method of the request"`
	Path                  *string            `json:"path" validate:"required" description:"The URL path for the request"`
	Params                []QueryParam       `json:"params,omitempty" description:"The URL query parameters"`
	Host                  *string            `json:"host" validate:"required" description:"Hostname serving the request"`
	UserAgent             *string            `json:"ua,omitempty" description:"User-Agent HTTP header"`
	Route                 *string            `json:"route" validate:"required" description:"Rails route for the API endpoint"`
	RemoteIP              *string            `json:"remote_ip,omitempty" description:"The remote IP address of the HTTP request"`
	UserID                *int64             `json:"user_id,omitempty" description:"The user id of the request"`
	UserName              *string            `json:"username,omitempty" description:"The username of the request"`
	GitalyCalls           *int               `json:"gitaly_calls,omitempty" description:"Total number of calls made to Gitaly"`
	GitalyDurationSeconds *float32           `json:"gitaly_duration_s,omitempty" description:"Total time taken by Gitaly calls"`
	RedisCalls            *int               `json:"redis_calls,omitempty" description:"Total number of calls made to Redis"`
	RedisDurationSeconds  *float32           `json:"redis_duration_s,omitempty" description:"Total time to retrieve data from Redis"`
	CorrelationID         *string            `json:"correlation_id,omitempty" description:"Request unique id across logs"`
	QueueDuration         *float32           `json:"queue_duration_s,omitempty" description:"Total time that the request was queued inside GitLab Workhorse"`
	MetaUser              *string            `json:"meta.user,omitempty" description:"User that invoked the request"`
	MetaProject           *string            `json:"meta.project,omitempty" description:"Project associated with the request"`
	MetaRootNamespace     *string            `json:"meta.root_namespace,omitempty" description:"Root namespace"`
	MetaCallerID          *string            `json:"meta.caller_id,omitempty" description:"Caller ID"`

	parsers.PantherLog
}

API is a a GitLab log line from an internal API endpoint nolint: lll

type APIParser

type APIParser struct{}

APIParser parses gitlab rails logs

func (*APIParser) LogType

func (p *APIParser) LogType() string

LogType returns the log type supported by this parser

func (*APIParser) New

func (p *APIParser) New() parsers.LogParser

New creates a new parser

func (*APIParser) Parse

func (p *APIParser) Parse(log string) ([]*parsers.PantherLog, error)

Parse returns the parsed events or nil if parsing failed

type Audit

type Audit struct {
	Severity      *string            `json:"severity" validate:"required" description:"The log level"`
	Time          *timestamp.RFC3339 `json:"time" validate:"required" description:"The event timestamp"`
	AuthorID      *int64             `json:"author_id" validate:"required" description:"User id that made the change"`
	EntityID      *int64             `json:"entity_id" validate:"required" description:"Id of the entity that was modified"`
	EntityType    *string            `json:"entity_type" validate:"required" description:"Type of the modified entity"`
	Change        *string            `json:"change" validate:"required" description:"Type of change to the settings"`
	From          *string            `json:"from" validate:"required" description:"Old setting value"`
	To            *string            `json:"to" validate:"required" description:"New setting value"`
	AuthorName    *string            `json:"author_name" validate:"required" description:"Name of the user that made the change"`
	TargetID      *int64             `json:"target_id" validate:"required" description:"Target id of the modified setting"`
	TargetType    *string            `json:"target_type" validate:"required" description:"Target type of the modified setting"`
	TargetDetails *string            `json:"target_details" validate:"required" description:"Details of the target of the modified setting"`

	parsers.PantherLog
}

Audit is a a GitLab log line from a failed interaction with git nolint: lll

type AuditParser

type AuditParser struct{}

AuditParser parses gitlab rails logs

func (*AuditParser) LogType

func (p *AuditParser) LogType() string

LogType returns the log type supported by this parser

func (*AuditParser) New

func (p *AuditParser) New() parsers.LogParser

New creates a new parser

func (*AuditParser) Parse

func (p *AuditParser) Parse(log string) ([]*parsers.PantherLog, error)

Parse returns the parsed events or nil if parsing failed

type Exceptions

type Exceptions struct {
	Severity           *string            `json:"severity" validate:"required" description:"The log level"`
	Time               *timestamp.RFC3339 `json:"time" validate:"required" description:"The event timestamp"`
	CorrelationID      *string            `json:"correlation_id,omitempty" description:"Request unique id across logs"`
	ExtraServer        *ExtraServer       `json:"extra.server,omitempty" description:"Information about the server on which the exception occurred"`
	ExtraProjectID     *int64             `json:"extra.project_id,omitempty" description:"Project id where the exception occurred"`
	ExtraRelationKey   *string            `json:"extra.relation_key,omitempty" description:"Relation on which the exception occurred"`
	ExtraRelationIndex *int64             `json:"extra.relation_index,omitempty" description:"Relation index on which the exception occurred"`
	ExceptionClass     *string            `json:"exception.class" validate:"required" description:"Class name of the exception that occurred"`
	ExceptionMessage   *string            `json:"exception.message" validate:"required" description:"Message of the exception that occurred"`
	ExceptionBacktrace []string           `json:"exception.backtrace,omitempty" description:"Stack trace of the exception that occurred"`

	parsers.PantherLog
}

Exceptions is a a GitLab log line from a failed interaction with git nolint: lll

type ExceptionsParser

type ExceptionsParser struct{}

ExceptionsParser parses gitlab rails logs

func (*ExceptionsParser) LogType

func (p *ExceptionsParser) LogType() string

LogType returns the log type supported by this parser

func (*ExceptionsParser) New

New creates a new parser

func (*ExceptionsParser) Parse

func (p *ExceptionsParser) Parse(log string) ([]*parsers.PantherLog, error)

Parse returns the parsed events or nil if parsing failed

type ExtraServer

type ExtraServer struct {
	OS      *ServerOS      `json:"os" validation:"required" description:"Server OS info"`
	Runtime *ServerRuntime `json:"runtime" validation:"required" description:"Runtime executing gitlab code"`
}

ExtraServer has info about the server an exception occurred

type Git

type Git struct {
	Severity      *string            `json:"severity" validate:"required" description:"The log level"`
	Time          *timestamp.RFC3339 `json:"time" validate:"required" description:"The event timestamp"`
	CorrelationID *string            `json:"correlation_id,omitempty" description:"Unique id across logs"`
	Message       *string            `json:"message" validate:"required" description:"The error message from git"`

	parsers.PantherLog
}

Git is a a GitLab log line from a failed interaction with git

type GitParser

type GitParser struct{}

GitParser parses gitlab rails logs

func (*GitParser) LogType

func (p *GitParser) LogType() string

LogType returns the log type supported by this parser

func (*GitParser) New

func (p *GitParser) New() parsers.LogParser

New creates a new parser

func (*GitParser) Parse

func (p *GitParser) Parse(log string) ([]*parsers.PantherLog, error)

Parse returns the parsed events or nil if parsing failed

type Integrations

type Integrations struct {
	Severity     *string            `json:"severity" validate:"required" description:"The log level"`
	Time         *timestamp.RFC3339 `json:"time" validate:"required" description:"The event timestamp"`
	ServiceClass *string            `json:"service_class" validate:"required" description:"The class name of the integrated service"`
	ProjectID    *int64             `json:"project_id" validate:"required" description:"The project id the integration was running on"`
	ProjectPath  *string            `json:"project_path" validate:"required" description:"The project path the integration was running on"`
	Message      *string            `json:"message" validate:"required" description:"The log message from the service"`
	ClientURL    *string            `json:"client_url" validate:"required" description:"The client url of the service"`
	Error        *string            `json:"error,omitempty" description:"The error name if an error has occurred"`

	parsers.PantherLog
}

Integrations is a a GitLab log line from an integrated gitlab activity

type IntegrationsParser

type IntegrationsParser struct{}

IntegrationsParser parses gitlab integration logs

func (*IntegrationsParser) LogType

func (p *IntegrationsParser) LogType() string

LogType returns the log type supported by this parser

func (*IntegrationsParser) New

New creates a new parser

func (*IntegrationsParser) Parse

func (p *IntegrationsParser) Parse(log string) ([]*parsers.PantherLog, error)

Parse returns the parsed events or nil if parsing failed

type Production added in v1.4.0

type Production struct {
	Method                *string            `json:"method" validate:"required" description:"The HTTP method of the request"`
	Path                  *string            `json:"path" validate:"required" description:"The URL path for the request"`
	Format                *string            `json:"format" description:"The response output format"`
	Controller            *string            `json:"controller,omitempty" description:"The Production controller class name"`
	Action                *string            `json:"action,omitempty" validate:"required_without=EtagRoute" description:"The Production controller action"`
	Status                *int               `json:"status" validate:"required" description:"The HTTP response status code"`
	Time                  *timestamp.RFC3339 `json:"time" validate:"required" description:"The request timestamp"`
	Params                []QueryParam       `json:"params,omitempty" description:"The URL query parameters"`
	RemoteIP              *string            `json:"remote_ip,omitempty" description:"The remote IP address of the HTTP request"`
	UserID                *int64             `json:"user_id,omitempty" description:"The user id of the request"`
	UserName              *string            `json:"username,omitempty" description:"The username of the request"`
	UserAgent             *string            `json:"ua,omitempty" description:"The User-Agent of the requester"`
	QueueDurationSeconds  *float32           `json:"queue_duration_s,omitempty" description:"Total time that the request was queued inside GitLab Workhorse"`
	GitalyCalls           *int               `json:"gitaly_calls,omitempty" description:"Total number of calls made to Gitaly"`
	GitalyDurationSeconds *float32           `json:"gitaly_duration_s,omitempty" description:"Total time taken by Gitaly calls"`
	RedisCalls            *int               `json:"redis_calls,omitempty" description:"Total number of calls made to Redis"`
	RedisDurationSeconds  *float32           `json:"redis_duration_s,omitempty" description:"Total time to retrieve data from Redis"`
	RedisReadBytes        *int64             `json:"redis_read_bytes,omitempty" description:"Total bytes read from Redis"`
	RedisWriteBytes       *int64             `json:"redis_write_bytes,omitempty" description:"Total bytes written to Redis"`
	CorrelationID         *string            `json:"correlation_id,omitempty" description:"Request unique id across logs"`
	CPUSeconds            *float32           `json:"cpu_s,omitempty" description:" Total time spent on CPU"`
	DBDurationSeconds     *float32           `json:"db_duration_s,omitempty" description:"Total time to retrieve data from PostgreSQL"`
	ViewDurationSeconds   *float32           `json:"view_duration_s,omitempty" description:" Total time taken inside the Rails views"`
	DurationSeconds       *float32           `json:"duration_s" validate:"required" description:"Total time taken to retrieve the request"`
	MetaCallerID          *string            `json:"meta.caller_id,omitempty" description:"Caller ID"`
	Location              *string            `json:"location" description:"(Applies only to redirects) The redirect URL"`
	ExceptionClass        *string            `json:"exception.class,omitempty" description:"Class name of the exception that occurred"`
	ExceptionMessage      *string            `json:"exception.message,omitempty" description:"Message of the exception that occurred"`
	ExceptionBacktrace    []string           `json:"exception.backtrace,omitempty" description:"Stack trace of the exception that occurred"`
	EtagRoute             *string            `json:"etag_route,omitempty" validate:"required_without=Action" description:"Route name etag (on redirects)"`

	parsers.PantherLog
}

Production is a a GitLab Production controller log line from a non-API endpoint nolint:lll

type ProductionParser added in v1.4.0

type ProductionParser struct{}

ProductionParser parses gitlab rails logs

func (*ProductionParser) LogType added in v1.4.0

func (p *ProductionParser) LogType() string

LogType returns the log type supported by this parser

func (*ProductionParser) New added in v1.4.0

New creates a new parser

func (*ProductionParser) Parse added in v1.4.0

func (p *ProductionParser) Parse(log string) ([]*parsers.PantherLog, error)

Parse returns the parsed events or nil if parsing failed

type QueryParam

type QueryParam struct {
	Key   *string             `json:"key" validate:"required" description:"Query parameter name"`
	Value jsoniter.RawMessage `json:"value,omitempty" description:"Query parameter value"`
}

QueryParam is an HTTP query param as logged by LogRage

type ServerOS

type ServerOS struct {
	Name    *string `json:"name" validation:"required" description:"OS name"`
	Version *string `json:"version" validation:"required" description:"OS version"`
	Build   *string `json:"build" validation:"required" description:"OS build"`
}

ServerOS has info about the OS where an exception occurred

type ServerRuntime

type ServerRuntime struct {
	Name    *string `json:"name" validation:"required" description:"Runtime name"`
	Version *string `json:"version" validation:"required" description:"Runtime version"`
}

ServerRuntime has info about the runtime where an exception occurred

Jump to

Keyboard shortcuts

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