Documentation ¶
Index ¶
- Constants
- func FormatLog(style Format, hash string, messageCount int64, payload string) (string, error)
- func LogLabelSet(host string, options LabelSetOptions) model.LabelSet
- func NewElasticsearchLogContent(host, logLine string) ([]byte, error)
- func RandomLog(logType LogType, logSize int) (string, error)
- type ClientType
- type ElasticsearchLogContent
- type Format
- type LabelSetOptions
- type LogGenerator
- type LogType
- type Options
Constants ¶
View Source
const ( // SyntheticSampleSelection is a string of characters a SyntheticLogType will use // to create a synthetic log. SyntheticSampleSelection = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" )
Variables ¶
This section is empty.
Functions ¶
func LogLabelSet ¶
func LogLabelSet(host string, options LabelSetOptions) model.LabelSet
LogLabelSet creates a label set based on the configured options
func NewElasticsearchLogContent ¶
NewElasticsearchLogContent returns a byte array representing the json content for a log to be consumed by Elasticsearch.
Types ¶
type ClientType ¶
type ClientType string
ClientType describes the type of client to use for querying logs
const ( // FileClientType uses a file to write logs to FileClientType ClientType = "file" // LokiClientType uses a Promtail client to forward logs LokiClientType ClientType = "loki" // ElasticsearchClientType uses an Elasticsearch client to forward logs ElasticsearchClientType ClientType = "elasticsearch" )
type ElasticsearchLogContent ¶
type ElasticsearchLogContent struct { Hostname string `json:"hostname"` Service string `json:"service"` Level string `json:"level"` Component string `json:"component"` Body string `json:"body"` CreatedAt time.Time `json:"created_at"` }
ElasticsearchLogContent describes the json content for logs for Elasticsearch
type LabelSetOptions ¶
type LabelSetOptions string
LabelSetOptions describes which labels to include
const ( // ClientOnlyOption creates a label set with only the client label ClientOnlyOption LabelSetOptions = "client" // ClientHostOnlyOption creates a label set with only the client and host label ClientHostOnlyOption LabelSetOptions = "client-host" )
type LogGenerator ¶
type LogGenerator struct {
// contains filtered or unexported fields
}
LogGenerator describes an object which generates logs
func NewLogGenerator ¶
func NewLogGenerator(opts Options) (*LogGenerator, error)
func (*LogGenerator) GenerateLogs ¶
func (g *LogGenerator) GenerateLogs(logType LogType, logFormat Format, logSize int, labelOpts LabelSetOptions, randomizeHostname bool)
type LogType ¶
type LogType string
LogType describes the type of generated log
const ( // ApplicationLogType represents a log that is likely to be seen in an // application runtime environment. ApplicationLogType LogType = "application" // SyntheticLogType represents a log that is composed of random // alphabetical characters of a certain size. SyntheticLogType LogType = "synthetic" )
type Options ¶
type Options struct { // Client describes the client to use for forwarding Client ClientType // ClientURl is the endpoint to forward to ClientURL string // FileName is the name of the file to create and write to FileName string // Tenant is identification to use for Loki Tenant string // DisableSecurityCheck deactivates the TLS checks DisableSecurityCheck bool // LogsPerSecond is the number of logs to write per second LogsPerSecond int }
Options describes the settings that can be modified for the querier
Click to show internal directories.
Click to hide internal directories.