splunk

package
v0.0.0-...-23da3e3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsHome

func AbsHome(path string) string

AbsHome converts all tildes to the current user's absolute home path

func GetSearchDir

func GetSearchDir() string

GetSearchDir runs a prompt for the use to check where their spl files are for Splunk searching

func SearchInteractive

func SearchInteractive() string

SearchInteractive runs the interactive variant of SearchSync

func ValidSPL

func ValidSPL(path string) bool

ValidSPL checks if the filetype is a valid .spl file

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 is used to list actions that can be performed at the queried 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 is used to send a process reboot request to the Splunk instance

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