Documentation ¶
Index ¶
- Variables
- type Channel
- type Entry
- func (*Entry) Descriptor() ([]byte, []int)
- func (m *Entry) Marshal() (dAtA []byte, err error)
- func (m *Entry) MarshalTo(dAtA []byte) (int, error)
- func (m *Entry) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Entry) ProtoMessage()
- func (m *Entry) Reset()
- func (m *Entry) Size() (n int)
- func (m *Entry) String() string
- func (m *Entry) Unmarshal(dAtA []byte) error
- func (m *Entry) XXX_DiscardUnknown()
- func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Entry) XXX_Merge(src proto.Message)
- func (m *Entry) XXX_Size() int
- func (m *Entry) XXX_Unmarshal(b []byte) error
- type FileDetails
- func (*FileDetails) Descriptor() ([]byte, []int)
- func (m *FileDetails) Marshal() (dAtA []byte, err error)
- func (m *FileDetails) MarshalTo(dAtA []byte) (int, error)
- func (m *FileDetails) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*FileDetails) ProtoMessage()
- func (m *FileDetails) Reset()
- func (m *FileDetails) Size() (n int)
- func (m *FileDetails) String() string
- func (m *FileDetails) Unmarshal(dAtA []byte) error
- func (m *FileDetails) XXX_DiscardUnknown()
- func (m *FileDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FileDetails) XXX_Merge(src proto.Message)
- func (m *FileDetails) XXX_Size() int
- func (m *FileDetails) XXX_Unmarshal(b []byte) error
- type FileInfo
- func (*FileInfo) Descriptor() ([]byte, []int)
- func (m *FileInfo) Marshal() (dAtA []byte, err error)
- func (m *FileInfo) MarshalTo(dAtA []byte) (int, error)
- func (m *FileInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*FileInfo) ProtoMessage()
- func (m *FileInfo) Reset()
- func (m *FileInfo) Size() (n int)
- func (m *FileInfo) String() string
- func (m *FileInfo) Unmarshal(dAtA []byte) error
- func (m *FileInfo) XXX_DiscardUnknown()
- func (m *FileInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FileInfo) XXX_Merge(src proto.Message)
- func (m *FileInfo) XXX_Size() int
- func (m *FileInfo) XXX_Unmarshal(b []byte) error
- type Severity
- func (Severity) EnumDescriptor() ([]byte, []int)
- func (s Severity) IsSet() bool
- func (s Severity) MarshalYAML() (interface{}, error)
- func (s *Severity) Name() string
- func (s *Severity) Set(value string) error
- func (x Severity) String() string
- func (s Severity) Type() string
- func (s *Severity) UnmarshalYAML(fn func(interface{}) error) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthLog = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowLog = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupLog = fmt.Errorf("proto: unexpected end of group") )
var Channel_name = map[int32]string{
0: "DEV",
1: "OPS",
2: "HEALTH",
3: "STORAGE",
4: "SESSIONS",
5: "SQL_SCHEMA",
6: "USER_ADMIN",
7: "PRIVILEGES",
8: "SENSITIVE_ACCESS",
9: "SQL_EXEC",
10: "SQL_PERF",
11: "SQL_INTERNAL_PERF",
12: "TELEMETRY",
13: "CHANNEL_MAX",
}
var Channel_value = map[string]int32{
"DEV": 0,
"OPS": 1,
"HEALTH": 2,
"STORAGE": 3,
"SESSIONS": 4,
"SQL_SCHEMA": 5,
"USER_ADMIN": 6,
"PRIVILEGES": 7,
"SENSITIVE_ACCESS": 8,
"SQL_EXEC": 9,
"SQL_PERF": 10,
"SQL_INTERNAL_PERF": 11,
"TELEMETRY": 12,
"CHANNEL_MAX": 13,
}
var Severity_name = map[int32]string{
0: "UNKNOWN",
1: "INFO",
2: "WARNING",
3: "ERROR",
4: "FATAL",
5: "NONE",
6: "DEFAULT",
}
var Severity_value = map[string]int32{
"UNKNOWN": 0,
"INFO": 1,
"WARNING": 2,
"ERROR": 3,
"FATAL": 4,
"NONE": 5,
"DEFAULT": 6,
}
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel int32
Channel is the logical logging channel on which a message is sent. Different channels can be redirected to different sinks. All messages from the same channel are sent to the same sink(s).
Note: do not forget to run gen.sh (go generate) when changing this list or the explanatory comments.
const ( // DEV is used during development to collect log // details useful for troubleshooting that fall outside the // scope of other channels. It is also the default logging // channel for events not associated with a channel. // // This channel is special in that there are no constraints as to // what may or may not be logged on it. Conversely, users in // production deployments are invited to not collect `DEV` logs in // centralized logging facilities, because they likely contain // sensitive operational data. // See [Configure logs](configure-logs.html#dev-channel). Channel_DEV Channel = 0 // OPS is used to report "point" operational events, // initiated by user operators or automation: // // - Operator or system actions on server processes: process starts, // stops, shutdowns, crashes (if they can be logged), // including each time: command-line parameters, current version being run // - Actions that impact the topology of a cluster: node additions, // removals, decommissions, etc. // - Job-related initiation or termination // - [Cluster setting](cluster-settings.html) changes // - [Zone configuration](configure-replication-zones.html) changes Channel_OPS Channel = 1 // HEALTH is used to report "background" operational // events, initiated by CockroachDB or reporting on automatic processes: // // - Current resource usage, including critical resource usage // - Node-node connection events, including connection errors and // gossip details // - Range and table leasing events // - Up- and down-replication, range unavailability Channel_HEALTH Channel = 2 // STORAGE is used to report low-level storage // layer events (RocksDB/Pebble). Channel_STORAGE Channel = 3 // SESSIONS is used to report client network activity when enabled via // the `server.auth_log.sql_connections.enabled` and/or // `server.auth_log.sql_sessions.enabled` [cluster setting](cluster-settings.html): // // - Connections opened/closed // - Authentication events: logins, failed attempts // - Session and query cancellation // // This is typically configured in "audit" mode, with event // numbering and synchronous writes. Channel_SESSIONS Channel = 4 // SQL_SCHEMA is used to report changes to the // SQL logical schema, excluding privilege and ownership changes // (which are reported separately on the `PRIVILEGES` channel) and // zone configuration changes (which go to the `OPS` channel). // // This includes: // // - Database/schema/table/sequence/view/type creation // - Adding/removing/changing table columns // - Changing sequence parameters // // `SQL_SCHEMA` events generally comprise changes to the schema that affect the // functional behavior of client apps using stored objects. Channel_SQL_SCHEMA Channel = 5 // USER_ADMIN is used to report changes // in users and roles, including: // // - Users added/dropped // - Changes to authentication credentials (e.g., passwords, validity, etc.) // - Role grants/revocations // - Role option grants/revocations // // This is typically configured in "audit" mode, with event // numbering and synchronous writes. Channel_USER_ADMIN Channel = 6 // PRIVILEGES is used to report data // authorization changes, including: // // - Privilege grants/revocations on database, objects, etc. // - Object ownership changes // // This is typically configured in "audit" mode, with event // numbering and synchronous writes. Channel_PRIVILEGES Channel = 7 // SENSITIVE_ACCESS is used to report SQL // data access to sensitive data: // // - Data access audit events (when table audit is enabled via // [EXPERIMENTAL_AUDIT](experimental-audit.html)) // - SQL statements executed by users with the admin role // - Operations that write to system tables // // This is typically configured in "audit" mode, with event // numbering and synchronous writes. Channel_SENSITIVE_ACCESS Channel = 8 // SQL_EXEC is used to report SQL execution on // behalf of client connections: // // - Logical SQL statement executions (when enabled via the // `sql.trace.log_statement_execute` [cluster setting](cluster-settings.html)) // - uncaught Go panic errors during the execution of a SQL statement. Channel_SQL_EXEC Channel = 9 // SQL_PERF is used to report SQL executions // that are marked as "out of the ordinary" // to facilitate performance investigations. // This includes the SQL "slow query log". // // Arguably, this channel overlaps with `SQL_EXEC`. // However, we keep both channels separate for backward compatibility // with versions prior to v21.1, where the corresponding events // were redirected to separate files. Channel_SQL_PERF Channel = 10 // SQL_INTERNAL_PERF is like the `SQL_PERF` channel, but is aimed at // helping developers of CockroachDB itself. It exists as a separate // channel so as to not pollute the `SQL_PERF` logging output with // internal troubleshooting details. Channel_SQL_INTERNAL_PERF Channel = 11 // TELEMETRY reports telemetry events. Telemetry events describe // feature usage within CockroachDB and anonymizes any application- // specific data. Channel_TELEMETRY Channel = 12 // CHANNEL_MAX is the maximum allocated channel number so far. // This should be increased every time a new channel is added. Channel_CHANNEL_MAX Channel = 13 )
func (Channel) EnumDescriptor ¶
type Entry ¶
type Entry struct { // Severity is the importance of the log entry. See the // documentation for the Severity enum for more details. Severity Severity `protobuf:"varint,1,opt,name=severity,proto3,enum=cockroach.util.log.Severity" json:"severity,omitempty"` // Nanoseconds since the epoch. Time int64 `protobuf:"varint,2,opt,name=time,proto3" json:"time,omitempty"` // Goroutine ID. This helps match logging events with goroutine // stack dumps. Goroutine int64 `protobuf:"varint,6,opt,name=goroutine,proto3" json:"goroutine,omitempty"` // File name where the logging event was produced. Logging client // code can adjust this with the "depth" parameter. File string `protobuf:"bytes,3,opt,name=file,proto3" json:"file,omitempty"` // Line number in the file where the logging event was produced. Line int64 `protobuf:"varint,4,opt,name=line,proto3" json:"line,omitempty"` // Message contains the main text of the logging message. Message string `protobuf:"bytes,5,opt,name=message,proto3" json:"message,omitempty"` // Tags contains the context tags available in the context where the // entry was created. Tags string `protobuf:"bytes,7,opt,name=tags,proto3" json:"tags,omitempty"` // Counter is an entry counter, meant for use in audit logs as an // instrument against log repudiation. // See: https://en.wikipedia.org/wiki/Non-repudiation // // It is incremented for every use of the logger where the entry was // produced. Counter uint64 `protobuf:"varint,8,opt,name=counter,proto3" json:"counter,omitempty"` // Redactable is true if the message and tags fields include markers // to delineate sensitive information. In that case, confidentiality // can be obtained by only stripping away the data within this // marker. If redactable is false or unknown, the message should be // considered to only contain sensitive information, and should be // stripped away completely for confidentiality. Redactable bool `protobuf:"varint,9,opt,name=redactable,proto3" json:"redactable,omitempty"` // Channel is the channel on which the message was sent. Channel Channel `protobuf:"varint,10,opt,name=channel,proto3,enum=cockroach.util.log.Channel" json:"channel,omitempty"` // StructuredEnd, if non-zero, indicates that the entry // is structured; it is also the index // inside the Message field where the JSON payload ends (exclusive). StructuredEnd uint32 `protobuf:"varint,11,opt,name=structured_end,json=structuredEnd,proto3" json:"structured_end,omitempty"` // StructuredStart, when StructuredEnd is non-zero, is the index // inside the Message field where the JSON payload starts (inclusive). StructuredStart uint32 `protobuf:"varint,12,opt,name=structured_start,json=structuredStart,proto3" json:"structured_start,omitempty"` // StackTraceStart is the index inside Message where a detailed // stack trace starts. If zero, no stack trace is present. Stack // traces are always separated from the message using a newline // character. If a stack trace is included, StackTracePosition is // the index of the character immediately after the newline // character. // // We use an index-in-string field in the protobuf, instead of two // separate string fields, because previous-version consumers of // Entry are still expecting the message and the stack trace in the // same field. StackTraceStart uint32 `protobuf:"varint,13,opt,name=stack_trace_start,json=stackTraceStart,proto3" json:"stack_trace_start,omitempty"` }
Entry represents a cockroach log entry in the following two cases:
- when reading a log file using the crdb-v1 format, entries are parsed into this struct.
- when injecting an interceptor into the logging package, the interceptor is fed entries using this structure.
func (*Entry) Descriptor ¶
func (*Entry) ProtoMessage ¶
func (*Entry) ProtoMessage()
func (*Entry) XXX_DiscardUnknown ¶
func (m *Entry) XXX_DiscardUnknown()
func (*Entry) XXX_Marshal ¶
func (*Entry) XXX_Unmarshal ¶
type FileDetails ¶
type FileDetails struct { // program contains the combination of program name and log file // group name, separated by a hyphen. The program name part is // guaranteed to not contain hyphens itself; if there had been any // in the executable file name, they would be escaped to // underscores. The first hyphen separates the program name from the // file group name. The file group itself can contain hyphens. // // For example, if the field is set to "mybinary-my-log-group", // the program name is "mybinary" and the file group is "my-log-group". // // The field is also guaranteed not to contain periods. If there had // been periods in the executable file name, they would be replaced // by underscores. Program string `protobuf:"bytes,1,opt,name=program,proto3" json:"program,omitempty"` // host is the hostname part of the file name. // The field is guaranteed not to contain periods. If there had // been periods in the hostname, they would be replaced by underscores. Host string `protobuf:"bytes,2,opt,name=host,proto3" json:"host,omitempty"` // user_name is the unix username part of the file name. // The field is guaranteed not to contain periods. If there had // been periods in the username, they would be replaced by underscores. UserName string `protobuf:"bytes,3,opt,name=user_name,json=userName,proto3" json:"user_name,omitempty"` Time int64 `protobuf:"varint,5,opt,name=time,proto3" json:"time,omitempty"` PID int64 `protobuf:"varint,6,opt,name=pid,proto3" json:"pid,omitempty"` }
A FileDetails holds all of the particulars that can be parsed by the name of a log file.
func (*FileDetails) Descriptor ¶
func (*FileDetails) Descriptor() ([]byte, []int)
func (*FileDetails) Marshal ¶
func (m *FileDetails) Marshal() (dAtA []byte, err error)
func (*FileDetails) MarshalToSizedBuffer ¶
func (m *FileDetails) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*FileDetails) ProtoMessage ¶
func (*FileDetails) ProtoMessage()
func (*FileDetails) Reset ¶
func (m *FileDetails) Reset()
func (*FileDetails) Size ¶
func (m *FileDetails) Size() (n int)
func (*FileDetails) String ¶
func (m *FileDetails) String() string
func (*FileDetails) Unmarshal ¶
func (m *FileDetails) Unmarshal(dAtA []byte) error
func (*FileDetails) XXX_DiscardUnknown ¶
func (m *FileDetails) XXX_DiscardUnknown()
func (*FileDetails) XXX_Marshal ¶
func (m *FileDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FileDetails) XXX_Merge ¶
func (m *FileDetails) XXX_Merge(src proto.Message)
func (*FileDetails) XXX_Size ¶
func (m *FileDetails) XXX_Size() int
func (*FileDetails) XXX_Unmarshal ¶
func (m *FileDetails) XXX_Unmarshal(b []byte) error
type FileInfo ¶
type FileInfo struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` SizeBytes int64 `protobuf:"varint,2,opt,name=size_bytes,json=sizeBytes,proto3" json:"size_bytes,omitempty"` ModTimeNanos int64 `protobuf:"varint,3,opt,name=mod_time_nanos,json=modTimeNanos,proto3" json:"mod_time_nanos,omitempty"` Details FileDetails `protobuf:"bytes,4,opt,name=details,proto3" json:"details"` FileMode uint32 `protobuf:"varint,5,opt,name=file_mode,json=fileMode,proto3" json:"file_mode,omitempty"` }
func (*FileInfo) Descriptor ¶
func (*FileInfo) MarshalToSizedBuffer ¶
func (*FileInfo) ProtoMessage ¶
func (*FileInfo) ProtoMessage()
func (*FileInfo) XXX_DiscardUnknown ¶
func (m *FileInfo) XXX_DiscardUnknown()
func (*FileInfo) XXX_Marshal ¶
func (*FileInfo) XXX_Unmarshal ¶
type Severity ¶
type Severity int32
Severity is the severity level of individual log events.
Note: do not forget to run gen.sh (go generate) when changing this list or the explanatory comments.
const ( // UNKNOWN is populated into decoded log entries when the // severity could not be determined. Severity_UNKNOWN Severity = 0 // INFO is used for informational messages that do not // require action. Severity_INFO Severity = 1 // WARNING is used for situations which may require special handling, // where normal operation is expected to resume automatically. Severity_WARNING Severity = 2 // ERROR is used for situations that require special handling, // where normal operation could not proceed as expected. // Other operations can continue mostly unaffected. Severity_ERROR Severity = 3 // FATAL is used for situations that require an immedate, hard // server shutdown. A report is also sent to telemetry if telemetry // is enabled. Severity_FATAL Severity = 4 // NONE can be used in filters to specify that no messages // should be emitted. Severity_NONE Severity = 5 // DEFAULT is the end sentinel. It is used during command-line // handling to indicate that another value should be replaced instead // (depending on which command is being run); see cli/flags.go for // details. Severity_DEFAULT Severity = 6 )
func SeverityByName ¶
SeverityByName attempts to parse the passed in string into a severity. (i.e. ERROR, INFO). If it succeeds, the returned bool is set to true.
func (Severity) EnumDescriptor ¶
func (Severity) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface.
func (*Severity) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.