Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrWriterDisable = errors.New("Writer disbaled")
ErrWriterDisable is returned when there is an unrecoverable error detected and writing log messages will never succeed. Dispatcher will close and disbale the writer.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.0.10
type Config struct {
LogName string
}
Config provides writer relevant information from dispatcher
type Kind ¶ added in v0.1.0
type Kind uint
A Kind represents the specific kind of type that a Type represents. The zero Kind is not a valid kind.
type LogWriter ¶
type LogWriter interface { // Init is called when the dispatcher starts. In case ErrWriterStop is returned, the writer won't be // considered while writing log messages. Init(config Config) error // WriteLogMessages shall write given logMessages, which are sorted by their timestamp. Since every message // is premarshalled, their timestamps are provided in a separate array of same length with corresponding indices. // In case there is an unrecoverable error detected ErrWriterStop shall be returned to disbale the LogWriter and prevent // that WriteLogMessages is called again. WriteLogMessages(logMessages []json.RawMessage, timestamps []time.Time) error // PropertiesSchemaChanged is called when the schema of log messages changed. // E.g. yet unknown property has been added to a log message. // PropertiesSchemaChanged is called before the according log message is written with WriteLogMessages(). // An error can be returned to inform that something went wrong, but it won't be handled somehow. PropertiesSchemaChanged(schema map[string]Kind) error // Informs the writer that the dispatcher stopped Close() }
LogWriter interface that can be used ny the logDispatcher to write logs.
func NewAzureDataExplorerWriter ¶ added in v0.1.0
func NewAzureDataExplorerWriter() LogWriter
func NewAzureMonitorWriter ¶
func NewAzureMonitorWriter() LogWriter
NewAzureMonitorWriter returns new LogWriter that writes LogMessages to Azure Monitor (Azure Log Analytics Workspace) see also: https://docs.microsoft.com/de-de/azure/azure-monitor/platform/data-collector-api
customLogName is the record type in which the logs will be stored (can only contain letters, numbers, and underscore, and may not exceed 100 characters)
The used default URL is: "https://" + workspaceID + "." azureMonitorDomain + "/api/logs?api-version=2016-04-01" with the default azureMonitorDomain: "ods.opinsights.azure.com"
The following environemnt variables are used be used to configure the behaviour: LOGTHING_LOG_NAME - Log name under which log messages are stored (will be used as elasticsearch index or azure custom log type) LOGTHING_AZURE_WORKSPACE_ID - Azure log analytics workspace id LOGTHING_AZURE_WORKSPACE_KEY - Azure log analytics worksoace key LOGTHING_AZURE_MONITOR_DOMAIN - (optional) to overwrite the default azure monitor domain e.g. in China