Documentation ¶
Overview ¶
Package logging contains custom log formatters (plaintext, JSON and CEF) to use through Acra components. Logging mode and verbosity level can be configured for AcraServer, AcraConnector in the corresponding yaml files or passed as CLI parameter.
Index ¶
- Constants
- Variables
- func GetLogLevel() int
- func GetLoggerFromContext(ctx context.Context) *log.Entry
- func GetLoggerFromContextOk(ctx context.Context) (*log.Entry, bool)
- func IsDebugLevel(logger *log.Entry) bool
- func LoggerWithTrace(context context.Context, logger *log.Entry) *log.Entry
- func NewLoggerWithTrace(context context.Context) *log.Entry
- func NewWriter(logToConsole bool, logToFile string) (io.Writer, func(), error)
- func SetLogLevel(level int)
- func SetLoggerToContext(ctx context.Context, logger *log.Entry) context.Context
- func SetTraceStatus(ctx context.Context, isOn bool) context.Context
- func TimeToString(t time.Time) string
- type AcraCEFFormatter
- type AcraCryptoFormatter
- type AcraJSONFormatter
- type AcraTextFormatter
- type AuditLogHandler
- type AuditLogKeySetter
- type CEFTextFormatter
- type CefFormatterHook
- type CefLogParser
- type CryptoFormatter
- type Formatter
- type FormatterHook
- type IntegrityCheckVerifier
- type JSONFormatterHook
- type JSONLogParser
- type LogEntryInfo
- type LogEntryIntegrityCalculator
- type LogEntrySource
- type LogParser
- type LogSpanExporter
- type LoggerSetter
- type ParsedLogEntry
- type PlaintextFormatterHook
- type PlaintextLogParser
Constants ¶
const ( FieldKeyUnixTime = "unixTime" FieldKeyProduct = "product" FieldKeyVersion = "version" FieldKeySeverity = "severity" FieldKeyVendor = "vendor" FieldKeyEventCode = "code" )
Default key names for the default fields
const ( // 100 .. 200 some events EventCodeGeneral = 100 EventCodePoisonRecordDetectionMessage = 101 // 500 .. 600 errors EventCodeErrorGeneral = 500 EventCodeErrorWrongParam = 501 EventCodeErrorInvalidClientID = 502 // processes EventCodeErrorCantStartService = 505 EventCodeErrorCantForkProcess = 506 EventCodeErrorWrongConfiguration = 507 EventCodeErrorCantReadServiceConfig = 508 EventCodeErrorCantCloseConnectionToService = 509 // keys EventCodeErrorCantInitKeyStore = 510 EventCodeErrorCantReadKeys = 511 EventCodeErrorCantLoadMasterKey = 512 EventCodeErrorCantInitPrivateKeysEncryptor = 513 EventCodeErrorCacheIssues = 514 // system events EventCodeErrorCantGetFileDescriptor = 520 EventCodeErrorCantOpenFileByDescriptor = 521 EventCodeErrorFileDescriptionIsNotValid = 522 EventCodeErrorCantRegisterSignalHandler = 523 // transport / networks EventCodeErrorCantStartListenConnections = 530 EventCodeErrorCantStopListenConnections = 531 EventCodeErrorTransportConfiguration = 532 EventCodeErrorCantAcceptNewConnections = 533 EventCodeErrorCantStartConnection = 534 EventCodeErrorCantHandleSecureSession = 535 EventCodeErrorCantCloseConnection = 536 EventCodeErrorCantInitClientSession = 537 EventCodeErrorCantWrapConnection = 538 EventCodeErrorConnectionDroppedByTimeout = 539 // database EventCodeErrorCantConnectToDB = 540 EventCodeErrorCantCloseConnectionDB = 541 // acracensor EventCodeErrorCensorQueryIsNotAllowed = 560 EventCodeErrorCensorSetupError = 561 EventCodeErrorCensorBackgroundError = 562 EventCodeErrorCensorQueryParseError = 563 EventCodeErrorCensorIOError = 564 EventCodeErrorCensorQuerySerializeError = 565 EventCodeErrorCensorWriterMemoryError = 566 // response connector EventCodeErrorResponseConnectorCantWriteToDB = 570 EventCodeErrorResponseConnectorCantReadFromClient = 571 EventCodeErrorResponseConnectorCantWriteToClient = 572 EventCodeErrorResponseConnectorCantReadFromServer = 573 EventCodeErrorResponseConnectorCantWriteToServer = 574 EventCodeErrorResponseConnectorCantProcessColumn = 575 EventCodeErrorResponseConnectorCantProcessRow = 576 // decryptor EventCodeErrorCantInitDecryptor = 580 EventCodeErrorDecryptorCantDecryptBinary = 581 EventCodeErrorDecryptorCantSkipBeginInBlock = 582 EventCodeErrorDecryptorCantHandleRecognizedPoisonRecord = 583 EventCodeErrorDecryptorCantInitializeTLS = 584 EventCodeErrorDecryptorCantSetDeadlineToClientConnection = 585 EventCodeErrorDecryptorCantDecryptSymmetricKey = 586 EventCodeErrorDecryptorRecognizedPoisonRecord = 587 EventCodeErrorDecryptorReadPacket = 588 EventCodeErrorDecryptorCantCheckPoisonRecord = 589 // http api EventCodeErrorHTTPAPICantGenerateZone = 590 EventCodeErrorHTTPAPICantLoadAuthKey = 591 EventCodeErrorHTTPAPICantLoadAuthData = 592 EventCodeErrorHTTPAPICantDecryptAuthData = 593 // mysql processing EventCodeErrorProtocolProcessing = 600 // AcraTranslator EventCodeErrorTranslatorCantHandleHTTPRequest = 700 EventCodeErrorTranslatorMethodNotAllowed = 701 EventCodeErrorTranslatorMalformedURL = 702 EventCodeErrorTranslatorVersionNotSupported = 703 EventCodeErrorTranslatorEndpointNotSupported = 704 EventCodeErrorTranslatorCantParseRequestBody = 705 EventCodeErrorTranslatorZoneIDMissing = 706 EventCodeErrorTranslatorCantDecryptAcraStruct = 707 EventCodeErrorTranslatorCantReturnResponse = 708 EventCodeErrorTranslatorCantCloseConnection = 709 EventCodeErrorTranslatorCantHandleHTTPConnection = 710 EventCodeErrorTranslatorCantWrapConnectionToSS = 711 EventCodeErrorTranslatorCantAcceptNewHTTPConnection = 712 EventCodeErrorTranslatorCantHandleGRPCConnection = 713 EventCodeErrorTranslatorClientIDMissing = 714 EventCodeErrorTranslatorCantAcceptNewGRPCConnection = 715 EventCodeErrorTranslatorCantDecryptAcraBlock = 716 EventCodeErrorTranslatorZoneIDAndAdditionalDataNotSupported = 717 // tracing EventCodeErrorTracingCantSendTrace = 800 EventCodeErrorTracingCantReadTrace = 801 EventCodeErrorJaegerInvalidParameters = 811 EventCodeErrorJaegerExporter = 812 // encryptor EventCodeErrorEncryptQueryData = 900 EventCodeErrorEncryptorInitialization = 901 EventCodeErrorDataEncryptorInitialization = 902 EventCodeErrorEncryptorCantEncryptExpression = 903 EventCodeErrorCantEncryptData = 904 // metrics EventCodeErrorPrometheusHTTPHandler = 1000 EventCodeErrorCantWrapConnectionWithTimer = 1001 // connection processing on acra-server side EventCodeErrorGeneralConnectionProcessing = 1100 EventCodeErrorCreateFileFromDescriptor = 1101 // encoding/decoding EventCodeErrorCodingCantDecodeHexData = 1200 EventCodeErrorCodingCantSerializePostgresqlPacket = 1201 EventCodeErrorCodingCantParsePostgresqlParseCommand = 1202 EventCodeErrorCodingPostgresqlUnexpectedPacket = 1203 EventCodeErrorCodingPostgresqlPacketHandlerInitiailization = 1204 EventCodeErrorCodingPostgresqlCantExtractQueryString = 1205 EventCodeErrorCodingPostgresqlCantGenerateErrorPacket = 1206 EventCodeErrorCodingPostgresqlCantParseColumnsDescription = 1207 EventCodeErrorCodingPostgresqlOctalEscape = 1208 EventCodeErrorCodingCantDecodeSQLValue = 1209 // used as general error EventCodeErrorDBProtocolError = 1210 // network additional EventCodeErrorNetworkWrite = 1300 EventCodeErrorNetworkFlush = 1301 EventCodeErrorNetworkTLSGeneral = 1302 )
Event codes for different events in Acra services, splitted by groups and service.
const ( IntegrityKey = "integrity" AuditLogChainKey = "chain" NewAuditLogChainValue = "new" EndAuditLogChainValue = "end" JSONKeyValueDelimiter = "delimiter" SpaceDelimiter = " " EquallyDelimiter = "=" NewAuditLogChainSuffix = "chain=new" EndOfAuditLogChainSuffix = "chain=end" DataSplitToken = SpaceDelimiter + IntegrityKey + EquallyDelimiter EndOfAuditLogChainMessage = "End of current audit log chain" )
Set of constants used internally by logging package
const ( LogDebug = iota LogVerbose LogDiscard )
Log modes
const ( PlaintextFormatString = "plaintext" JSONFormatString = "json" CefFormatString = "cef" )
Log formats
Variables ¶
var ( ErrUnexpectedFormat = errors.New("unexpected log entry format") ErrIntegrityNotMatch = errors.New("integrity doesn't match") ErrPlaintextIntegrityExtract = errors.New("[plaintext] can't extract integrity part") ErrCefIntegrityExtract = errors.New("[cef] can't extract integrity part") ErrJSONIntegrityExtract = errors.New("[json] can't extract integrity part") ErrMissingEndOfChain = errors.New("end of audit log chain is missing") )
Set of error values related to enterprise logging
var ErrMissingCryptoHook = errors.New("crypto hook is missing")
ErrMissingCryptoHook is an error that occurs if hook with crypto abilities is not found in a set of formatter's hooks
var ( JSONFieldMap = logrus.FieldMap{ logrus.FieldKeyTime: "timestamp", logrus.FieldKeyMsg: "msg", logrus.FieldKeyLevel: "level", } )
Constants showing extra filed added to loggers by default
Functions ¶
func GetLogLevel ¶
func GetLogLevel() int
GetLogLevel gets logrus log level and returns int Acra log level
func GetLoggerFromContext ¶
GetLoggerFromContext gets logger from context, returns nil if no logger.
func GetLoggerFromContextOk ¶
GetLoggerFromContextOk gets logger from context, returns logger and success code.
func IsDebugLevel ¶
IsDebugLevel return true if logger configured to log debug messages
func LoggerWithTrace ¶
LoggerWithTrace return logger with added span_id/trace_id fields from context
func NewLoggerWithTrace ¶
NewLoggerWithTrace return logger with trace_id/span_id fields
func NewWriter ¶
NewWriter creates writer that outputs logs into stdout and also into file if necessary
func SetLoggerToContext ¶
SetLoggerToContext sets logger to corresponded context
func SetTraceStatus ¶
SetTraceStatus to context
func TimeToString ¶
TimeToString return string representation of timestamp with milliseconds
Types ¶
type AcraCEFFormatter ¶
type AcraCEFFormatter struct { CEFTextFormatter logrus.Fields Hooks []FormatterHook }
AcraCEFFormatter is based on CEFTextFormatter with extra logrus fields.
Hooks may be used for more fine-tuned post-processing of entries.
func (*AcraCEFFormatter) Format ¶
func (f *AcraCEFFormatter) Format(e *logrus.Entry) ([]byte, error)
Format formats an entry to a AcraCEF format according to the given Formatter and Fields.
Note: the given entry is copied and not changed during the formatting process.
func (*AcraCEFFormatter) GetHooks ¶
func (f *AcraCEFFormatter) GetHooks() []FormatterHook
GetHooks get formatter hooks
func (*AcraCEFFormatter) SetHooks ¶
func (f *AcraCEFFormatter) SetHooks(hooks []FormatterHook)
SetHooks set formatter hooks
func (*AcraCEFFormatter) SetServiceName ¶
func (f *AcraCEFFormatter) SetServiceName(serviceName string)
SetServiceName set service name
type AcraCryptoFormatter ¶
type AcraCryptoFormatter struct {
Formatter
}
AcraCryptoFormatter is an implementation of formatter with crypto hook
func CreateCryptoFormatter ¶
func CreateCryptoFormatter(format string) *AcraCryptoFormatter
CreateCryptoFormatter creates formatter object
func NewCryptoFormatter ¶
func NewCryptoFormatter(formatter Formatter) *AcraCryptoFormatter
NewCryptoFormatter creates new crypto formatter
func (*AcraCryptoFormatter) SetCryptoKey ¶
func (f *AcraCryptoFormatter) SetCryptoKey(key []byte) (err error)
SetCryptoKey is an implementation of crypto key setter
func (*AcraCryptoFormatter) SetHooks ¶
func (f *AcraCryptoFormatter) SetHooks(hooks []FormatterHook)
SetHooks sets hooks
func (*AcraCryptoFormatter) SetServiceName ¶
func (f *AcraCryptoFormatter) SetServiceName(serviceName string)
SetServiceName sets service name
type AcraJSONFormatter ¶
type AcraJSONFormatter struct { logrus.Formatter logrus.Fields Hooks []FormatterHook }
AcraJSONFormatter represents a format with specific fields.
It has logrus.Formatter which formats the entry and logrus.Fields which are added to the JSON/CEF message if not given in the entry data.
Hooks may be used for more fine-tuned post-processing of entries.
Note: use the `JSONFormatter` function to set a default AcraJSON formatter.
func (AcraJSONFormatter) Format ¶
func (f AcraJSONFormatter) Format(e *logrus.Entry) ([]byte, error)
Format formats an entry to a AcraJSON format according to the given Formatter and Fields.
Note: the given entry is copied and not changed during the formatting process.
func (*AcraJSONFormatter) GetHooks ¶
func (f *AcraJSONFormatter) GetHooks() []FormatterHook
GetHooks get formatter hooks
func (*AcraJSONFormatter) SetHooks ¶
func (f *AcraJSONFormatter) SetHooks(hooks []FormatterHook)
SetHooks set formatter hooks
func (*AcraJSONFormatter) SetServiceName ¶
func (f *AcraJSONFormatter) SetServiceName(serviceName string)
SetServiceName set service name
type AcraTextFormatter ¶
type AcraTextFormatter struct { logrus.Formatter Hooks []FormatterHook }
AcraTextFormatter provides log formatting as plaintext.
Hooks may be used for additional post-processing of entries.
Use `TextFormatter` to instantiate AcraTextFormatter.
func (*AcraTextFormatter) Format ¶
func (f *AcraTextFormatter) Format(e *logrus.Entry) ([]byte, error)
Format a log entry in standard plaintext format.
func (*AcraTextFormatter) GetHooks ¶
func (f *AcraTextFormatter) GetHooks() []FormatterHook
GetHooks get formatter hooks
func (*AcraTextFormatter) SetHooks ¶
func (f *AcraTextFormatter) SetHooks(hooks []FormatterHook)
SetHooks set formatter hooks
func (*AcraTextFormatter) SetServiceName ¶
func (f *AcraTextFormatter) SetServiceName(serviceName string)
SetServiceName set service name
type AuditLogHandler ¶
type AuditLogHandler struct {
// contains filtered or unexported fields
}
AuditLogHandler is a coordinator of both formatter and writer objects. It's main purpose is 1) making log entries formatting and writing atomically and 2) to provide convenient methods for audit log functionality usage by acra services. It also guarantees that audit log chain can't be broken (started, but not finalized and vice versa)
func NewAuditLogHandler ¶
func NewAuditLogHandler(formatter *AcraCryptoFormatter, writer io.Writer) (*AuditLogHandler, error)
NewAuditLogHandler creates new handler
func (*AuditLogHandler) FinalizeChain ¶
func (h *AuditLogHandler) FinalizeChain()
FinalizeChain finalizes current audit log chain
func (*AuditLogHandler) Format ¶
func (h *AuditLogHandler) Format(e *log.Entry) ([]byte, error)
Format is a version of typical Format which is used by logrus with it's internal lock
func (*AuditLogHandler) ResetChain ¶
func (h *AuditLogHandler) ResetChain(key []byte)
ResetChain finalizes current chain if if necessary and starts new audit log chain
type AuditLogKeySetter ¶
AuditLogKeySetter is an auxiliary interface used for decorating formatter's hook
type CEFTextFormatter ¶
type CEFTextFormatter struct { // TimestampFormat to use for display when a full timestamp is printed TimestampFormat string // QuoteEmptyFields will wrap empty fields in quotes if true QuoteEmptyFields bool // By default 'CEF:0' CEFPrefixString string // By default 'os.Hostname()' HostName string // start log with syslog prefix automatically ShouldAddSyslogPrefix bool sync.Once }
CEFTextFormatter formats logs into text
type CefFormatterHook ¶
type CefFormatterHook struct {
// contains filtered or unexported fields
}
CefFormatterHook struct to provide audit_log with cef formatter
func NewCefFormatterHook ¶
func NewCefFormatterHook(key []byte) (*CefFormatterHook, error)
NewCefFormatterHook create new hook with cef formatter support to provide audit_log
func (*CefFormatterHook) PostFormat ¶
PostFormat handler adds integrity to output
func (*CefFormatterHook) PreFormat ¶
func (h *CefFormatterHook) PreFormat(entry *log.Entry) error
PreFormat handler adds (if necessary) "end of chain" marker to the entry in order to cryptographically bound it to the integrity computation
func (*CefFormatterHook) SetCryptoKey ¶
func (h *CefFormatterHook) SetCryptoKey(key []byte) error
SetCryptoKey sets crypto key of this crypto hook
type CefLogParser ¶
type CefLogParser struct{}
CefLogParser struct used as LogParser implementation for cef format
func (*CefLogParser) ParseEntry ¶
func (parser *CefLogParser) ParseEntry(rawData string) (*ParsedLogEntry, error)
ParseEntry parse cef log line with next expected input example and return ParsedLogEntry: CEF:0|<value>|<value>|<value>|100|<value>|1|unixTime=<value> integrity=<value> chain=<value> CEF:0|<value>|<value>|<value>|100|<value>|1|unixTime=<value> integrity=<value>
type CryptoFormatter ¶
type CryptoFormatter interface { Formatter AuditLogKeySetter }
CryptoFormatter is an auxiliary interface that decorates usual formatter's hook with crypto key setter
type Formatter ¶
type Formatter interface { log.Formatter SetServiceName(serviceName string) SetHooks(hooks []FormatterHook) GetHooks() []FormatterHook }
Formatter wraps log.Formatter interface and adds functions for customizations. Intention for this interface is to provide ability to customize logging by accustomed: `SetServiceName` / `SetHooks` from main function of Acra services
func CEFFormatter ¶
func CEFFormatter() Formatter
CEFFormatter returns a default CEFTextFormatter with specific settings
func CreateFormatter ¶
CreateFormatter creates formatter object
func JSONFormatter ¶
func JSONFormatter() Formatter
JSONFormatter returns a default logrus.JSONFormatter with specific settings
func TextFormatter ¶
func TextFormatter() Formatter
TextFormatter returns a default logrus.TextFormatter with specific settings
type FormatterHook ¶
type FormatterHook interface { // PreFormat is called before the entry is serialized by the formatter. // You may inspect as well as add or remove fields of the log entry. // If the error is not nil, formatting fails with returned error. PreFormat(entry *log.Entry) error // PostFormat is called after the entry has been serialized by the formatter. // You may inspect log entry fields and the byte buffer with serialized data. // You may also modify the resulting buffer with serialized entry. // If the error is not nil, formatting fails with returned error. PostFormat(entry *log.Entry, formatted *bytes.Buffer) error }
FormatterHook provides post-processing customization to log formatters, allowing you to execute additional code before or after an entry is completed.
type IntegrityCheckVerifier ¶
type IntegrityCheckVerifier struct {
// contains filtered or unexported fields
}
IntegrityCheckVerifier implement audit log verification
func NewIntegrityCheckVerifier ¶
func NewIntegrityCheckVerifier(key []byte, parser LogParser) (*IntegrityCheckVerifier, error)
NewIntegrityCheckVerifier return new IntegrityCheckVerifier with configure secret key and parser
func (*IntegrityCheckVerifier) VerifyIntegrityCheck ¶
func (v *IntegrityCheckVerifier) VerifyIntegrityCheck(source *LogEntrySource) (*LogEntryInfo, error)
VerifyIntegrityCheck verify all lines incoming to channel (which is a part of input log entry source) until it will be closed and return (nil, nil) if fully verified, otherwise return current log entry with error occurred
type JSONFormatterHook ¶
type JSONFormatterHook struct {
// contains filtered or unexported fields
}
JSONFormatterHook struct to provide audit_log with json formatter
func NewJSONFormatterHook ¶
func NewJSONFormatterHook(key []byte) (*JSONFormatterHook, error)
NewJSONFormatterHook create new hook with json formatter support to provide audit_log
func (*JSONFormatterHook) PostFormat ¶
PostFormat handler adds integrity to output
func (*JSONFormatterHook) PreFormat ¶
func (h *JSONFormatterHook) PreFormat(entry *log.Entry) error
PreFormat handler adds (if necessary) "end of chain" marker to the entry in order to cryptographically bound it to the integrity computation
func (*JSONFormatterHook) SetCryptoKey ¶
func (h *JSONFormatterHook) SetCryptoKey(key []byte) error
SetCryptoKey sets crypto key of this crypto hook
type JSONLogParser ¶
type JSONLogParser struct{}
JSONLogParser struct used as LogParser implementation for json format
func (*JSONLogParser) ParseEntry ¶
func (parser *JSONLogParser) ParseEntry(rawData string) (*ParsedLogEntry, error)
ParseEntry parse json log line with next expected input example and return ParsedLogEntry: {"chain": "<val>","integrity":"<val>", "level":"<val>","msg":"<val>","product":"<val>","timestamp":"<val>","unixTime":"<val>","version":"<val>"} {"integrity":"<val>", "level":"<val>","msg":"<val>","product":"<val>","timestamp":"<val>","unixTime":"<val>","version":"<val>"}
type LogEntryInfo ¶
LogEntryInfo consists from raw log entry and metadata
type LogEntryIntegrityCalculator ¶
type LogEntryIntegrityCalculator struct {
// contains filtered or unexported fields
}
LogEntryIntegrityCalculator implements audit log with hash generation with configured secret key
func NewLogEntryIntegrityCalculator ¶
func NewLogEntryIntegrityCalculator(key []byte) *LogEntryIntegrityCalculator
NewLogEntryIntegrityCalculator return new LogEntryIntegrityCalculator with configured secret key
func (*LogEntryIntegrityCalculator) CalculateIntegrityCheck ¶
func (f *LogEntryIntegrityCalculator) CalculateIntegrityCheck(input []byte) ([]byte, bool, error)
CalculateIntegrityCheck calculate integrity hash, return hash, flag is created new hash cycle and error if something went wrong
func (*LogEntryIntegrityCalculator) ResetCryptoKey ¶
func (f *LogEntryIntegrityCalculator) ResetCryptoKey(key []byte)
ResetCryptoKey reset calculator internal state and setup new secret key
type LogEntrySource ¶
type LogEntrySource struct { Entries <-chan *LogEntryInfo Error error }
LogEntrySource is a stream of log entries for verification. When Entries is exhausted, look into Error to check if an error occurred
func ReadLogEntries ¶
func ReadLogEntries(absoluteFileNames []string, isMissingOk, debug bool) *LogEntrySource
ReadLogEntries sequentially reads log entries from provided file list and pushes them into a channel
type LogParser ¶
type LogParser interface { // ParseEntry is called for extracting information from log entry string (with concrete format) ParseEntry(logEntry string) (*ParsedLogEntry, error) }
LogParser is a common interface for parsers that are used for processing raw log entries that are passed as strings
func NewLogParser ¶
NewLogParser return LogParser according to format
type LogSpanExporter ¶
type LogSpanExporter struct{}
LogSpanExporter exporter for opencensus that print all spans with logger
func (*LogSpanExporter) ExportSpan ¶
func (e *LogSpanExporter) ExportSpan(vd *trace.SpanData)
ExportSpan log the trace span
type LoggerSetter ¶
LoggerSetter abstract types that provide way to set logger which they should use
type ParsedLogEntry ¶
ParsedLogEntry struct store log data and related integrity metadata
type PlaintextFormatterHook ¶
type PlaintextFormatterHook struct {
// contains filtered or unexported fields
}
PlaintextFormatterHook struct to provide audit_log with plaintext formatter
func NewPlaintextFormatterHook ¶
func NewPlaintextFormatterHook(key []byte) (*PlaintextFormatterHook, error)
NewPlaintextFormatterHook create new hook with plaintext formatter support to provide audit_log
func (*PlaintextFormatterHook) PostFormat ¶
PostFormat handler adds integrity to output
func (*PlaintextFormatterHook) PreFormat ¶
func (h *PlaintextFormatterHook) PreFormat(entry *log.Entry) error
PreFormat handler adds (if necessary) "end of chain" marker to the entry in order to cryptographically bound it to the integrity computation
func (*PlaintextFormatterHook) SetCryptoKey ¶
func (h *PlaintextFormatterHook) SetCryptoKey(key []byte) error
SetCryptoKey sets crypto key of this crypto hook
type PlaintextLogParser ¶
type PlaintextLogParser struct{}
PlaintextLogParser struct used as LogParser implementation for plaintext format
func (*PlaintextLogParser) ParseEntry ¶
func (parser *PlaintextLogParser) ParseEntry(rawData string) (*ParsedLogEntry, error)
ParseEntry parse plaintext log line with next expected input example and return ParsedLogEntry: time="<value>" level=<value> msg="<value>" version=<value> integrity=<value> chain=<value> time="<value>" level=<value> msg="<value>" version=<value> integrity=<value>