splunk

package
v0.0.0-...-aac3333 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SearchInteractive

func SearchInteractive() string

SearchInteractive runs the interactive variant of search

Types

type Connection

type Connection struct {
	Username, Password, BaseURL string
	// contains filtered or unexported fields
}

Connection contains the primary auth parameters for connecting to Splunk

func CreateConnectionFromEnvironment

func CreateConnectionFromEnvironment() (*Connection, error)

CreateConnectionFromEnvironment sets up a splunk connection

func (Connection) AppInspect

func (conn Connection) AppInspect(path string) (string, error)

AppInspect inspects queried app's details and properties.

func (Connection) GetMessage

func (conn Connection) GetMessage(name string) ([]Message, error)

GetMessage fetches and unmarshalls a message from Splunk

func (Connection) InspectControl

func (conn Connection) InspectControl(endpoint string) (string, error)

InspectControl Lists actions that can be performed at this endpoint.

func (Connection) InstallApp

func (conn Connection) InstallApp(path string, update bool) (string, error)

InstallApp installs splunk apps

func (*Connection) Login

func (conn *Connection) Login() (SessionKey, error)

Login connects to the Splunk server and retrieves a session key

func (Connection) RestartServer

func (conn Connection) RestartServer() (string, error)

RestartServer performs a reboot operation Splunk

func (Connection) SearchSync

func (conn Connection) SearchSync(searchString string, outputMode string) (string, error)

SearchSync performs a search job on splunk with the provided search string

func (Connection) SendMessage

func (conn Connection) SendMessage(message *Message) (string, error)

SendMessage sends an informational message to Splunk

type Message

type Message struct {
	Name    string         `json:"name"`
	Content MessageContent `json:"content"`
}

Message contains the name and content of the message in JSON

type MessageContent

type MessageContent struct {
	Message  string          `json:"message"`
	Severity MessageSeverity `json:"severity"`
	Created  int64           `json:"timeCreated_epochSecs"`
}

MessageContent contains the aggregation of MessageSeverity and Message

func (*MessageContent) Content

func (mc *MessageContent) Content() time.Time

Content logs the time of the message

type MessageSeverity

type MessageSeverity string

MessageSeverity contains the significance of a message in string form

const (
	// Info is a message of type informational
	Info MessageSeverity = "info"
	// Warn is a message of type warn
	Warn MessageSeverity = "warn"
	// Error is a message of type error
	Error MessageSeverity = "error"
)

type Messages

type Messages struct {
	Origin   string    `json:"origin"`
	Messages []Message `json:"entry"`
}

Messages is the plural of the Message struct

type SessionKey

type SessionKey struct {
	Value string `json:"sessionKey,omitempty"`
}

SessionKey represents the JSON object returned from the Splunk authentication REST call

Jump to

Keyboard shortcuts

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