|
package logging
|
Generated documentation is available at:
https://godoc.org/github.com/RedHatInsights/insights-operator-controller/logging
Documentation in literate-programming-style is available at:
https://redhatinsights.github.io/insights-operator-controller/packages/logging/splunk.html
|
import (
"github.com/ZachtimusPrime/Go-Splunk-HTTP/splunk"
)
|
Client represents a Splunk client instance.
|
type Client struct {
ClientImpl * splunk . Client
}
|
NewClient creates a new instance of Splunk client.
|
func NewClient ( enabled bool , address , token , source , sourceType , index string ) Client {
if enabled {
url := address + "/services/collector/raw"
splunkClient := splunk . NewClient ( nil , url , token , source , sourceType , index )
return Client { ClientImpl : splunkClient }
}
return Client { ClientImpl : nil }
}
|
Log add a new message into the Splunk log.
|
func ( client Client ) Log ( key , value string ) error {
if client . ClientImpl != nil {
err := client . ClientImpl . Log (
map [ string ] string { key : value } )
return err
}
return nil
}
|
LogAction add a new message about performed action into the Splunk log.
|
func ( client Client ) LogAction ( action , user , description string ) error {
if client . ClientImpl != nil {
err := client . ClientImpl . Log (
map [ string ] string {
"action" : action ,
"user" : user ,
"description" : description } )
return err
}
return nil
}
|
LogTriggerAction add a new message about performed trigger-related action into the Splunk log.
|
func ( client Client ) LogTriggerAction ( action , user , cluster , trigger string ) error {
if client . ClientImpl != nil {
err := client . ClientImpl . Log (
map [ string ] string {
"action" : action ,
"user" : user ,
"cluster" : cluster ,
"trigger" : trigger } )
return err
}
return nil
}
|
LogWithTime add a new message with timestamp into the Splunk log.
|
func ( client Client ) LogWithTime ( time int64 , key , value string ) error {
if client . ClientImpl != nil {
err := client . ClientImpl . LogWithTime (
time ,
map [ string ] string { key : value } )
return err
}
return nil
}
|