MySQL 9.0.0
Source Code Documentation
|
#include <mysql/components/services/log_builtins.h>
#include <mysql/components/services/log_shared.h>
#include <mysql/components/services/log_sink_perfschema.h>
#include <string>
#include "log_service_imp.h"
#include "my_compiler.h"
#include "my_rapidjson_size_t.h"
#include <rapidjson/document.h>
Classes | |
struct | my_state |
Macros | |
#define | WITH_PFS_SUPPORT |
This is a "modern" log writer, i.e. More... | |
#define | WITH_LOG_PARSER |
#define | LOG_EXT ".json" |
Log-file extension. More... | |
#define | MY_RAPID_INT(key, val, dflt) |
#define | MY_RAPID_STR(key, val, len) |
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) | |
REQUIRES_SERVICE_PLACEHOLDER (log_builtins_string) | |
REQUIRES_SERVICE_PLACEHOLDER (log_sink_perfschema) | |
static log_service_error | get_json_log_name (void *instance, char *buf, size_t bufsize) |
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) | |
REQUIRES_SERVICE (log_sink_perfschema) | |
END_COMPONENT_REQUIRES () | |
METADATA ("mysql.author", "Oracle Corporation") | |
METADATA ("mysql.license", "GPL") | |
METADATA ("log_service_type", "sink") | |
END_COMPONENT_METADATA () | |
Variables | |
const mysql_service_log_builtins_t * | log_bi = nullptr |
accessor built-ins More... | |
const mysql_service_log_builtins_string_t * | log_bs = nullptr |
string built-ins More... | |
const mysql_service_log_sink_perfschema_t * | log_ps = nullptr |
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 |
#define LOG_EXT ".json" |
Log-file extension.
#define MY_RAPID_INT | ( | key, | |
val, | |||
dflt | |||
) |
#define MY_RAPID_STR | ( | key, | |
val, | |||
len | |||
) |
#define WITH_LOG_PARSER |
#define WITH_PFS_SUPPORT |
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 classes (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 \"logging as traditional MySQL error log and as JSON"", "time" : "1970-01-01T00:00:00.000000Z", "thread" : 0, "err_symbol" : "ER_PARSER_TRACE", "label" : "Note" }
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 |
END_COMPONENT_METADATA | ( | ) |
END_COMPONENT_PROVIDES | ( | ) |
END_COMPONENT_REQUIRES | ( | ) |
|
static |
mysql_service_status_t log_service_exit | ( | ) |
De-initialization method for Component used when unloading the Component.
false | success |
true | failure |
mysql_service_status_t log_service_init | ( | ) |
Initialization entry method for Component used when loading the Component.
false | success |
true | failure |
METADATA | ( | "log_service_type" | , |
"sink" | |||
) |
METADATA | ( | "mysql.author" | , |
"Oracle Corporation" | |||
) |
METADATA | ( | "mysql.license" | , |
"GPL" | |||
) |
PROVIDES_SERVICE | ( | log_sink_json | , |
log_service | |||
) |
REQUIRES_SERVICE | ( | log_builtins | ) |
REQUIRES_SERVICE | ( | log_builtins_string | ) |
REQUIRES_SERVICE | ( | log_sink_perfschema | ) |
REQUIRES_SERVICE_PLACEHOLDER | ( | log_builtins | ) |
REQUIRES_SERVICE_PLACEHOLDER | ( | log_builtins_string | ) |
REQUIRES_SERVICE_PLACEHOLDER | ( | log_sink_perfschema | ) |
const mysql_service_log_service_t imp_log_sink_json_log_service |
|
static |
const mysql_service_log_builtins_t* log_bi = nullptr |
accessor built-ins
const mysql_service_log_builtins_string_t* log_bs = nullptr |
string built-ins
const mysql_service_log_sink_perfschema_t* log_ps = nullptr |
mysql_component_t mysql_component_log_sink_json |
|
static |
|
static |