splunk

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LogsEndpoint endpoint for log retrieval
	LogsEndpoint = "/services/search/jobs"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertActionFunc

type AlertActionFunc func(payload AlertActionWHPayload)

AlertActionFunc api users can add this function and after every webhook message all of them will be notified

type AlertActionWHPayload

type AlertActionWHPayload struct {
	// First result row from the triggering search results
	Result wHFirstResult `json:"result"`

	// Search ID or SID for the saved search that triggered the alert
	Sid string `json:"sid"`

	// Link to search results
	ResultsLink string `json:"results_link"`

	// Search owner
	Owner string `json:"owner"`

	// Search app
	App string `json:"app"`
}

AlertActionWHPayload is unmarshal-ed json payload of alert webhook action

type LogResults

type LogResults struct {
	Results []struct {
		Fields []struct {
			Name  string `xml:"k,attr"`
			Value struct {
				Text string `xml:"text"`
			} `xml:"value"`
		} `xml:"field"`
	} `xml:"result"`
}

LogResults stores result of log fetching

type PluginAPI

type PluginAPI interface {
	SendEphemeralPost(userID string, post *model.Post) *model.Post
	CreatePost(post *model.Post) (*model.Post, error)

	GetUsersInChannel(channelID, sortBy string, page, perPage int) ([]*model.User, error)
	PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast)
	store.API
}

PluginAPI API form mattermost plugin

type Splunk

type Splunk interface {
	PluginAPI

	User() store.SplunkUser
	SyncUser(mattermostUserID string) error
	LoginUser(mattermostUserID string, server string, id string) error
	LogoutUser(mattermostUserID string) error

	AddAlert(string, string) error
	Notify(string, AlertActionWHPayload) error
	ListAlert(string) ([]string, error)
	DeleteAlert(string, string) error

	AddBotUser(string)
	BotUser() string

	Logs(string) (LogResults, error)
	ListLogs() []string
}

Splunk API for business logic

func New

func New(api PluginAPI, st store.Store) Splunk

New returns new Splunk API object

Jump to

Keyboard shortcuts

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