utils

package
v0.0.0-...-8028b39 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GraylogPort = "9000"
)

Variables

This section is empty.

Functions

func ContainsPattern

func ContainsPattern(pattern GrokPattern, list []GrokPattern) bool

func CreateGrokPatternBody

func CreateGrokPatternBody(p GrokPattern, allGrokPatterns []GrokPattern) (string, error)

func CreatePipelineBody

func CreatePipelineBody(pipelineId string, streamId string) (string, error)

func CreateRuleBody

func CreateRuleBody(title string, description string, source string) (string, error)

func CreateStreamBody

func CreateStreamBody(description string, title string, indexSets []Entity, indexSetName string) (string, error)

func FindById

func FindById(slice []Entity, val string) (int, bool)

func GetDefaultStreams

func GetDefaultStreams() []loggingService.Stream

func GetIdByTitle

func GetIdByTitle(values []Entity, title string) string

func GetPattern

func GetPattern(name string, patterns []GrokPattern) string

Types

type DTOGrokPattern

type DTOGrokPattern struct {
	Name    string `json:"name"`
	Pattern string `json:"pattern"`
}

type Entity

type Entity struct {
	Id    string `json:"id"`
	Title string `json:"title"`
}

type GraylogConnector

type GraylogConnector struct {
	RestClient           *util.RestClient
	OpenSearchRestClient *util.RestClient
	Log                  logr.Logger
	Assets               embed.FS
	EnabledStreams       []Stream
	TLSEnabled           bool
}

func CreateConnector

func CreateConnector(ctx context.Context, cr *loggingService.LoggingService, assets embed.FS, clientSet kubernetes.Interface) (*GraylogConnector, error)

func (*GraylogConnector) ConnectPipeline

func (connector *GraylogConnector) ConnectPipeline(pipelines []Entity) error

func (*GraylogConnector) CreateAuditViewerData

func (connector *GraylogConnector) CreateAuditViewerData(dashboards []Entity, template string) (string, error)

func (*GraylogConnector) CreateDefaultInput

func (connector *GraylogConnector) CreateDefaultInput(cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateExtractor

func (connector *GraylogConnector) CreateExtractor(template string, inputId string, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateExtractors

func (connector *GraylogConnector) CreateExtractors(extractors []Entity, extractorsAssets map[string]string, inputId string, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateGrokPatterns

func (connector *GraylogConnector) CreateGrokPatterns(existingGrokPatterns []GrokPattern, allGrokPatterns []GrokPattern) error

func (*GraylogConnector) CreateIndexSet

func (connector *GraylogConnector) CreateIndexSet(cr *loggingService.LoggingService, path string, indexSetName string) error

func (*GraylogConnector) CreateOperatorData

func (connector *GraylogConnector) CreateOperatorData(dashboards []Entity, template string) (string, error)

func (*GraylogConnector) CreateOrUpdateDefaultInput

func (connector *GraylogConnector) CreateOrUpdateDefaultInput(inputs []Entity, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateOrUpdateExtractors

func (connector *GraylogConnector) CreateOrUpdateExtractors(extractors []Entity, extractorsAssets map[string]string, id string, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateOrUpdateGrokPatterns

func (connector *GraylogConnector) CreateOrUpdateGrokPatterns(existingGrokPatterns []GrokPattern,
	cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateOrUpdateIndexSet

func (connector *GraylogConnector) CreateOrUpdateIndexSet(indexSets []Entity, cr *loggingService.LoggingService, path string, title string) error

func (*GraylogConnector) CreateOrUpdatePipelines

func (connector *GraylogConnector) CreateOrUpdatePipelines(pipelines []Entity, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateOrUpdateProcessingRules

func (connector *GraylogConnector) CreateOrUpdateProcessingRules(processingRules []Entity, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateOrUpdateRole

func (connector *GraylogConnector) CreateOrUpdateRole(role string, data string, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateOrUpdateRoles

func (connector *GraylogConnector) CreateOrUpdateRoles(dashboards []Entity, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateOrUpdateRules

func (connector *GraylogConnector) CreateOrUpdateRules(streams []Entity, processingRules []Entity, ruleTitle string, streamTitle string, description string, pathConfig string) error

func (*GraylogConnector) CreateOrUpdateSavedSearches

func (connector *GraylogConnector) CreateOrUpdateSavedSearches(savedSearches []Entity, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateOrUpdateStreams

func (connector *GraylogConnector) CreateOrUpdateStreams(streams []Entity, indexSets []Entity, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateOrUpdateUser

func (connector *GraylogConnector) CreateOrUpdateUser(user string, template string, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateOrUpdateUsers

func (connector *GraylogConnector) CreateOrUpdateUsers(cr *loggingService.LoggingService) error

func (*GraylogConnector) CreatePipeline

func (connector *GraylogConnector) CreatePipeline(pipelines []Entity, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateProcessingRules

func (connector *GraylogConnector) CreateProcessingRules(processingRules []Entity) error

func (*GraylogConnector) CreateRole

func (connector *GraylogConnector) CreateRole(data string) error

func (*GraylogConnector) CreateRule

func (connector *GraylogConnector) CreateRule(title string, description string, source string) error

func (*GraylogConnector) CreateRuleData

func (connector *GraylogConnector) CreateRuleData(streams []Entity, title string, template string) (string, error)

func (*GraylogConnector) CreateSavedSearches

func (connector *GraylogConnector) CreateSavedSearches(savedSearches []Entity, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateSearch

func (connector *GraylogConnector) CreateSearch(savedSearches []Entity, title string, template string, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateStream

func (connector *GraylogConnector) CreateStream(indexSets []Entity, indexSetName string, description string, title string) error

func (*GraylogConnector) CreateStreams

func (connector *GraylogConnector) CreateStreams(streams []Entity, indexSets []Entity) error

func (*GraylogConnector) CreateUser

func (connector *GraylogConnector) CreateUser(template string, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateView

func (connector *GraylogConnector) CreateView(savedSearches []Entity, title string, template string, cr *loggingService.LoggingService) error

func (*GraylogConnector) CreateViews

func (connector *GraylogConnector) CreateViews(savedSearches []Entity, cr *loggingService.LoggingService) error

func (*GraylogConnector) DELETE

func (connector *GraylogConnector) DELETE(url string) (string, int, error)

func (*GraylogConnector) DeleteDefaultContentPack

func (connector *GraylogConnector) DeleteDefaultContentPack() error

DeleteDefaultContentPack gets content pack installation, deletes its (because content pack can not be deleted if installations exist) and deletes content pack

func (*GraylogConnector) DeleteExtractor

func (connector *GraylogConnector) DeleteExtractor(inputId string, id string) error

func (*GraylogConnector) EnableAuthHeader

func (connector *GraylogConnector) EnableAuthHeader(cr *loggingService.LoggingService) error

func (*GraylogConnector) GET

func (connector *GraylogConnector) GET(url string) (string, int, error)

func (*GraylogConnector) GetAllExtractors

func (connector *GraylogConnector) GetAllExtractors(id string) ([]Entity, error)

func (*GraylogConnector) GetAllGrokPatterns

func (connector *GraylogConnector) GetAllGrokPatterns() (string, error)

func (*GraylogConnector) GetAllIndexSets

func (connector *GraylogConnector) GetAllIndexSets() ([]Entity, error)

func (*GraylogConnector) GetAllInputs

func (connector *GraylogConnector) GetAllInputs() ([]Entity, error)

func (*GraylogConnector) GetAllPipelines

func (connector *GraylogConnector) GetAllPipelines() ([]Entity, error)

func (*GraylogConnector) GetAllProcessingRules

func (connector *GraylogConnector) GetAllProcessingRules() ([]Entity, error)

func (*GraylogConnector) GetAllStreams

func (connector *GraylogConnector) GetAllStreams() ([]Entity, error)

func (*GraylogConnector) GetAllUsers

func (connector *GraylogConnector) GetAllUsers() ([]User, error)

func (*GraylogConnector) GetAllViews

func (connector *GraylogConnector) GetAllViews() ([]Entity, error)

func (*GraylogConnector) GetData

func (connector *GraylogConnector) GetData(url string, field string, replaceFunc func(response string) string) ([]Entity, error)

func (*GraylogConnector) GetIndexSets

func (connector *GraylogConnector) GetIndexSets() map[string]string

func (*GraylogConnector) GetProcessingRules

func (connector *GraylogConnector) GetProcessingRules() map[string]string

func (*GraylogConnector) GetRawData

func (connector *GraylogConnector) GetRawData(url string) (string, error)

func (*GraylogConnector) GetRole

func (connector *GraylogConnector) GetRole(role string) (int, error)

func (*GraylogConnector) GetStreams

func (connector *GraylogConnector) GetStreams() map[string]string

func (*GraylogConnector) GetUser

func (connector *GraylogConnector) GetUser(user string) (int, error)

func (*GraylogConnector) GetUserIdByName

func (connector *GraylogConnector) GetUserIdByName(username string) string

func (*GraylogConnector) InstallDefaultContentPack

func (connector *GraylogConnector) InstallDefaultContentPack(cr *loggingService.LoggingService) error

func (*GraylogConnector) ManageArchivesDirectory

func (connector *GraylogConnector) ManageArchivesDirectory(cr *loggingService.LoggingService) error

func (*GraylogConnector) ManageAuthHeaderConfig

func (connector *GraylogConnector) ManageAuthHeaderConfig(cr *loggingService.LoggingService) error

func (*GraylogConnector) ManageContentPackTLS

func (connector *GraylogConnector) ManageContentPackTLS(ctx context.Context, cr *loggingService.LoggingService, clientSet kubernetes.Interface) error

func (*GraylogConnector) ManageContentPacks

func (connector *GraylogConnector) ManageContentPacks(cr *loggingService.LoggingService) error

func (*GraylogConnector) ManageCustomSavedSearches

func (connector *GraylogConnector) ManageCustomSavedSearches(cr *loggingService.LoggingService) error

func (*GraylogConnector) ManageDashboards

func (connector *GraylogConnector) ManageDashboards(cr *loggingService.LoggingService) error

func (*GraylogConnector) ManageExtractors

func (connector *GraylogConnector) ManageExtractors(cr *loggingService.LoggingService, installGraylog5 bool) error

func (*GraylogConnector) ManageGrokPatterns

func (connector *GraylogConnector) ManageGrokPatterns(cr *loggingService.LoggingService) error

func (*GraylogConnector) ManageIndexSets

func (connector *GraylogConnector) ManageIndexSets(cr *loggingService.LoggingService) error

func (*GraylogConnector) ManageInputs

func (connector *GraylogConnector) ManageInputs(cr *loggingService.LoggingService) error

func (*GraylogConnector) ManageOpensearchConfigs

func (connector *GraylogConnector) ManageOpensearchConfigs(cr *loggingService.LoggingService) (err error)

func (*GraylogConnector) ManagePipelines

func (connector *GraylogConnector) ManagePipelines(cr *loggingService.LoggingService) error

func (*GraylogConnector) ManageProcessingRules

func (connector *GraylogConnector) ManageProcessingRules(cr *loggingService.LoggingService) error

func (*GraylogConnector) ManageSavedSearches

func (connector *GraylogConnector) ManageSavedSearches(cr *loggingService.LoggingService) error

func (*GraylogConnector) ManageStreams

func (connector *GraylogConnector) ManageStreams(cr *loggingService.LoggingService) error

func (*GraylogConnector) ManageUserAccounts

func (connector *GraylogConnector) ManageUserAccounts(cr *loggingService.LoggingService, installGraylog5 bool) error

func (*GraylogConnector) OnlyCreateRules

func (connector *GraylogConnector) OnlyCreateRules(streams []Entity, processingRules []Entity, ruleTitle string, streamTitle string, description string, pathConfig string) error

func (*GraylogConnector) OnlyCreateStream

func (connector *GraylogConnector) OnlyCreateStream(streams []Entity, indexSets []Entity, indexSetName string, description string, title string) error

func (*GraylogConnector) POST

func (connector *GraylogConnector) POST(url string, data string) (string, int, error)

func (*GraylogConnector) PUT

func (connector *GraylogConnector) PUT(url string, data string) (string, int, error)

func (*GraylogConnector) ResumeStream

func (connector *GraylogConnector) ResumeStream(id string) error

func (*GraylogConnector) ResumeStreamByTitle

func (connector *GraylogConnector) ResumeStreamByTitle(streams []Entity, title string) error

func (*GraylogConnector) ResumeStreams

func (connector *GraylogConnector) ResumeStreams(streams []Entity) error

func (*GraylogConnector) Send

func (connector *GraylogConnector) Send(urlPath string, method string, data string) (string, int, error)

func (*GraylogConnector) SendRequestToOpenSearch

func (connector *GraylogConnector) SendRequestToOpenSearch(method string, urlPath string, data []byte, cr *loggingService.LoggingService) error

func (*GraylogConnector) UpdateAllExtractors

func (connector *GraylogConnector) UpdateAllExtractors(extractors []Entity, extractorsAssets map[string]string, inputId string, cr *loggingService.LoggingService) error

func (*GraylogConnector) UpdateDefaultInput

func (connector *GraylogConnector) UpdateDefaultInput(id string, cr *loggingService.LoggingService) error

func (*GraylogConnector) UpdateExtractor

func (connector *GraylogConnector) UpdateExtractor(template string, inputId string, id string, cr *loggingService.LoggingService) error

func (*GraylogConnector) UpdateGrokPatterns

func (connector *GraylogConnector) UpdateGrokPatterns(existingGrokPatterns []GrokPattern, allGrokPatterns []GrokPattern) error

func (*GraylogConnector) UpdateIndexSet

func (connector *GraylogConnector) UpdateIndexSet(id string, cr *loggingService.LoggingService, path string, indexSetName string) error

func (*GraylogConnector) UpdateMessageProcessorsOrder

func (connector *GraylogConnector) UpdateMessageProcessorsOrder(cr *loggingService.LoggingService) error

func (*GraylogConnector) UpdateOrCreateSavedSearches

func (connector *GraylogConnector) UpdateOrCreateSavedSearches(savedSearches []Entity, cr *loggingService.LoggingService) error

func (*GraylogConnector) UpdateOrCreateSearch

func (connector *GraylogConnector) UpdateOrCreateSearch(savedSearches []Entity, title string, template string, cr *loggingService.LoggingService) error

func (*GraylogConnector) UpdateOrCreateStream

func (connector *GraylogConnector) UpdateOrCreateStream(streams []Entity, indexSets []Entity, indexSetName string, description string, title string) error

func (*GraylogConnector) UpdatePipeline

func (connector *GraylogConnector) UpdatePipeline(pipelines []Entity, cr *loggingService.LoggingService) error

func (*GraylogConnector) UpdateProcessingRules

func (connector *GraylogConnector) UpdateProcessingRules(processingRules []Entity) error

func (*GraylogConnector) UpdateRole

func (connector *GraylogConnector) UpdateRole(role string, data string) error

func (*GraylogConnector) UpdateRule

func (connector *GraylogConnector) UpdateRule(ruleId string, title string, description string, source string) error

func (*GraylogConnector) UpdateStream

func (connector *GraylogConnector) UpdateStream(streamId string, indexSets []Entity, indexSetName string, description string, title string) error

func (*GraylogConnector) UpdateStreams

func (connector *GraylogConnector) UpdateStreams(streams []Entity, indexSets []Entity) error

func (*GraylogConnector) UpdateUser

func (connector *GraylogConnector) UpdateUser(user string, template string, cr *loggingService.LoggingService) error

func (*GraylogConnector) Upload

func (connector *GraylogConnector) Upload(path string, template string, cr *loggingService.LoggingService) error

func (*GraylogConnector) UploadConfig

func (connector *GraylogConnector) UploadConfig(name string, cr *loggingService.LoggingService, configsDir string) error

func (*GraylogConnector) UploadContentPack

func (connector *GraylogConnector) UploadContentPack(name string, cr *loggingService.LoggingService) error

func (*GraylogConnector) UploadContentPacks

func (connector *GraylogConnector) UploadContentPacks(cr *loggingService.LoggingService) error

func (*GraylogConnector) UploadCustomSavedSearch

func (connector *GraylogConnector) UploadCustomSavedSearch(name string, cr *loggingService.LoggingService) error

func (*GraylogConnector) UploadDefaultContentPack

func (connector *GraylogConnector) UploadDefaultContentPack(cr *loggingService.LoggingService) error

type GrokPattern

type GrokPattern struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	Pattern string `json:"pattern"`
}

type PipelinePattern

type PipelinePattern struct {
	PipelineIds []string `json:"pipeline_ids"`
	StreamId    string   `json:"stream_id"`
}

type Request

type Request struct {
	Method string      `json:"method"`
	URL    string      `json:"url"`
	Body   interface{} `json:"body,omitempty"`
}

type RulePattern

type RulePattern struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Source      string `json:"source"`
}

type SecretEventWatcher

type SecretEventWatcher struct {
	Clientset *kubernetes.Clientset
	Selector  string
	Log       logr.Logger
}

func (*SecretEventWatcher) Watch

type Stream

type Stream struct {
	Title              string
	RotationStrategy   string
	RotationPeriod     string
	MaxSize            int
	MaxNumberOfIndices int
}

func GetStreams

func GetStreams(cr *loggingService.LoggingService) []Stream

type StreamPattern

type StreamPattern struct {
	MatchingType string `json:"matching_type"`
	Description  string `json:"description"`
	Title        string `json:"title"`
	IndexSetId   string `json:"index_set_id"`
}

type Streams

type Streams struct {
	IntegrationLogsEnabled bool
	AccessLogsEnabled      bool
	BillCycleLogsEnabled   bool
}

type User

type User struct {
	Id       string `json:"id"`
	Username string `json:"username"`
}

Jump to

Keyboard shortcuts

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