MySQL  8.0.17
Source Code Documentation
log_sink_json.cc File Reference

Classes

struct  my_state
 

Enumerations

enum  enum_log_json_pretty_print { JSON_NOSPACE = 0, JSON_PAD = 1, JSON_MULTILINE = 2 }
 Pretty-print (with indents and line-breaks between key/value pairs), or one event per line? jq for example doesn't mind, but we play it safe by defaulting to the latter; this is also the format that "journalctl -o json" renders on platforms that use systemd's journal. More...
 

Functions

 REQUIRES_SERVICE_PLACEHOLDER (log_builtins)
 
This is a "modern" log writer, i.e. More...
 
 REQUIRES_SERVICE_PLACEHOLDER (log_builtins_string)
 
mysql_service_status_t log_service_exit ()
 De-initialization method for Component used when unloading the Component. More...
 
mysql_service_status_t log_service_init ()
 Initialization entry method for Component used when loading the Component. More...
 
 PROVIDES_SERVICE (log_sink_json, log_service)
 
 END_COMPONENT_PROVIDES ()
 
 REQUIRES_SERVICE (log_builtins)
 
 REQUIRES_SERVICE (log_builtins_string)
 
 END_COMPONENT_REQUIRES ()
 
 METADATA ("mysql.author", "T.A. Nuernberg, Oracle Corporation")
 
 METADATA ("mysql.license", "GPL")
 
 METADATA ("log_service_type", "sink")
 
 END_COMPONENT_METADATA ()
 

Variables

const mysql_service_log_builtins_tlog_bi = nullptr
 accessor built-ins More...
 
const mysql_service_log_builtins_string_tlog_bs = nullptr
 string built-ins More...
 
static bool inited = false
 
static int opened = 0
 
static enum_log_json_pretty_print pretty = JSON_PAD
 
const mysql_service_log_service_t imp_log_sink_json_log_service
 
mysql_component_t mysql_component_log_sink_json
 

Enumeration Type Documentation

◆ enum_log_json_pretty_print

Pretty-print (with indents and line-breaks between key/value pairs), or one event per line? jq for example doesn't mind, but we play it safe by defaulting to the latter; this is also the format that "journalctl -o json" renders on platforms that use systemd's journal.

Enumerator
JSON_NOSPACE 

emit no whitespace padding

JSON_PAD 

similar to systemd's journal

JSON_MULTILINE 

multi-line pretty-print

Function Documentation

◆ END_COMPONENT_METADATA()

END_COMPONENT_METADATA ( )

◆ END_COMPONENT_PROVIDES()

END_COMPONENT_PROVIDES ( )

◆ END_COMPONENT_REQUIRES()

END_COMPONENT_REQUIRES ( )

◆ log_service_exit()

mysql_service_status_t log_service_exit ( )

De-initialization method for Component used when unloading the Component.

Returns
Status of performed operation
Return values
falsesuccess
truefailure

◆ log_service_init()

mysql_service_status_t log_service_init ( )

Initialization entry method for Component used when loading the Component.

Returns
Status of performed operation
Return values
falsesuccess
truefailure

◆ METADATA() [1/3]

METADATA ( "mysql.author"  ,
"T.A.  Nuernberg,
Oracle Corporation"   
)

◆ METADATA() [2/3]

METADATA ( "mysql.license"  ,
"GPL"   
)

◆ METADATA() [3/3]

METADATA ( "log_service_type"  ,
"sink"   
)

◆ PROVIDES_SERVICE()

PROVIDES_SERVICE ( log_sink_json  ,
log_service   
)

◆ REQUIRES_SERVICE() [1/2]

REQUIRES_SERVICE ( log_builtins_string  )

◆ REQUIRES_SERVICE() [2/2]

REQUIRES_SERVICE ( log_builtins  )

◆ REQUIRES_SERVICE_PLACEHOLDER() [1/2]

REQUIRES_SERVICE_PLACEHOLDER ( log_builtins  )


This is a "modern" log writer, i.e.

it doesn't care what type a log_item on an error log event is; as long as it's one of the wellknown types (string, float, int), it can and will write it.

By default, each line will contain one log event, in a format somewhat similar to that emitted by "journalctl -o json" on platforms that use systemd's journal:

{ "prio" : 2, "err_code" : 3581, "msg" : "Parser saw: SET @@global.log_error_filter_rules= DEFAULT", "err_symbol" : "ER_PARSER_TRACE", "label" : "Note" } { "prio" : 2, "err_code" : 3581, "subsystem" : "parser", "SQL_state" : "XX999", "source_file" : "sql_parse", "function" : "dispatch_command", "msg" : "Parser saw: SELECT \"loging as traditional MySQL error log and as JSON"", "time" : "1970-01-01T00:00:00.000000Z", "thread" : 0, "err_symbol" : "ER_PARSER_TRACE", "label" : "Note" }

◆ REQUIRES_SERVICE_PLACEHOLDER() [2/2]

REQUIRES_SERVICE_PLACEHOLDER ( log_builtins_string  )

Variable Documentation

◆ imp_log_sink_json_log_service

const mysql_service_log_service_t imp_log_sink_json_log_service
Initial value:
= {
static int characteristics(void) noexcept
Get characteristics of a log-service.
Definition: log_filter_dragnet.cc:1624
static int run(void *instance, log_line *ll) noexcept
Have the service process one log line.
Definition: log_filter_dragnet.cc:1544
static int close(void **instance) noexcept
Close and release an instance.
Definition: log_filter_dragnet.cc:1588
static int open(log_line *ll, void **instance) noexcept
Open a new instance.
Definition: log_filter_dragnet.cc:1567
static int flush(void **instance) noexcept
Flush any buffers.
Definition: log_filter_dragnet.cc:1614

◆ inited

bool inited = false
static

◆ log_bi

const mysql_service_log_builtins_t* log_bi = nullptr

accessor built-ins

◆ log_bs

const mysql_service_log_builtins_string_t* log_bs = nullptr

string built-ins

◆ mysql_component_log_sink_json

mysql_component_t mysql_component_log_sink_json
Initial value:
= { "mysql:log_sink_json" , __log_sink_json_provides, __log_sink_json_requires, __log_sink_json_metadata,
mysql_service_status_t log_service_init()
Initialization entry method for Component used when loading the Component.
Definition: log_sink_json.cc:390
mysql_service_status_t log_service_exit()
De-initialization method for Component used when unloading the Component.
Definition: log_sink_json.cc:374

◆ opened

int opened = 0
static

◆ pretty