Documentation ¶
Overview ¶
Package splunk includes Splunk Enterprise implementation of Gnomock Preset interface. This Preset can be passed to gnomock.StartPreset function to create a configured Splunk container to use in tests.
Splunk image is relatively heavy (larger than 1.5GB), and its startup time is longer than usual. Using this container may make the tests much longer.
Index ¶
Constants ¶
const ( // CollectorPort is the name of a port exposed by Splunk Collector. CollectorPort string = "collector" // APIPort is the name of a port exposed by Splunk API. APIPort string = "api" // WebPort is the name of a port exposed by Splunk web UI. WebPort string = "web" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Event ¶
type Event struct { // Event is the actual log entry. Can be any format Event string `json:"event"` // Index is the name of index to ingest the log into. If the index does not // exist, it will be created Index string `json:"index"` // Source will be used as "source" value of this event in Splunk Source string `json:"source"` // SourceType will be used as "sourcetype" value of this event in Splunk SourceType string `json:"sourcetype"` // Time represents event timestamp in seconds, milliseconds or nanoseconds // (and maybe even in microseconds, whatever splunk recognizes) Time int64 `json:"time"` }
Event is a type used during Splunk initialization. Pass events to WithValues to ingest them into the container before the control over it is passed to the caller.
type Option ¶
type Option func(*P)
Option is an optional configuration of this Gnomock preset. Use available Options to configure the container.
func WithLicense ¶
WithLicense lets the user choose to accept Splunk enterprise license (see more at https://hub.docker.com/_/splunk-enterprise). Failure to accept the license will prevent Splunk container from starting.
func WithPassword ¶
WithPassword sets admin password in Splunk container. Use this password to connect to the container when it is ready. Note that Splunk has password requirements. Failure to meet those will prevent the container from starting (see defaults at https://docs.splunk.com/Documentation/Splunk/latest/Security/Configurepasswordsinspecfile)
func WithValues ¶
WithValues initializes Splunk with the provided values as log entries.
func WithValuesFile ¶
WithValuesFile sets file name to use as a source of initial events to ingest. These events are ingested first, followed by any other events sent using WithValues.
func WithVersion ¶
WithVersion sets splunk version (see https://hub.docker.com/r/splunk/splunk/tags) for available versions
type P ¶
type P struct { Values []Event `json:"values"` ValuesFile string `json:"values_file"` AcceptLicense bool `json:"accept_license"` AdminPassword string `json:"admin_password"` Version string `json:"version"` }
P is a Gnomock Preset implementation of Splunk.
func (*P) Ports ¶
func (p *P) Ports() gnomock.NamedPorts
Ports returns ports that should be used to access this container.