MySQL 8.0.40
Source Code Documentation
|
#include <mysql/components/services/log_builtins.h>
#include "log_service_imp.h"
#include "m_string.h"
#include "my_compiler.h"
#include "my_io.h"
#include "my_sys.h"
#include "mysqld_error.h"
#include <mysql/components/component_implementation.h>
#include <mysql/components/service_implementation.h>
#include <mysql/components/services/component_sys_var_service.h>
#include <mysql/plugin.h>
#include "../sql/set_var.h"
#include <syslog.h>
Classes | |
struct | SYSLOG_FACILITY |
Macros | |
#define | LOG_DAEMON_NAME "daemon" |
#define | OPT_FAC "facility" |
#define | OPT_PID "include_pid" |
#define | OPT_TAG "tag" |
#define | LOG_TYPE "syslog" |
#define | MAX_FAC_LEN 32 |
#define | MAX_TAG_LEN 32 |
#define | PREFIX "mysqld" |
#define | MY_NAME "syseventlog" |
Functions | |
REQUIRES_SERVICE_PLACEHOLDER (component_sys_variable_register) | |
REQUIRES_SERVICE_PLACEHOLDER (component_sys_variable_unregister) | |
REQUIRES_SERVICE_PLACEHOLDER (log_builtins) | |
REQUIRES_SERVICE_PLACEHOLDER (log_builtins_string) | |
REQUIRES_SERVICE_PLACEHOLDER (log_builtins_syseventlog) | |
STR_CHECK_ARG (tag) values_tag | |
syslog default tag More... | |
STR_CHECK_ARG (fac) values_fac | |
syslog default facility More... | |
BOOL_CHECK_ARG (pid) values_pid | |
syslog default PID state More... | |
static bool | log_syslog_find_facility (const char *f, SYSLOG_FACILITY *rsf) |
On being handed a syslog facility name tries to look it up. More... | |
static int | log_syslog_close () |
Close POSIX syslog / Windows EventLog. More... | |
int | log_syslog_open () |
Open POSIX syslog / Windows EventLog. More... | |
static void | log_syslog_reopen () |
Syslog settings have changed; close and re-open. More... | |
void | log_syslog_exit (void) |
Stop using syslog / EventLog. More... | |
static int | var_check_tag (const char *tag) |
Internal state: Validate new tag to log under. More... | |
static int | var_update_tag (const char *tag) |
Internal state: Update tag to log under. More... | |
static int | var_check_fac (const char *fac) |
Internal state: Validate facility to log under. More... | |
static int | var_update_fac (char *fac) |
Internal state: Update facility to log under May change facility to its canonical representation if needed. More... | |
static int | var_update_pid (bool inc_pid) |
Internal state: Toggle inclusion of process ID (pid) More... | |
static int | sysvar_check_tag (MYSQL_THD thd, SYS_VAR *self, void *save, struct st_mysql_value *value) |
System-variable: Check proposed value for component variable controlling tag to log under. More... | |
static void | sysvar_update_tag (MYSQL_THD thd, SYS_VAR *self, void *var_ptr, const void *save) |
System-variable: Update value of component variable controlling tag to log under Updates internal state as needed. More... | |
static int | sysvar_install_tag (void) |
Set up system variable containing the tag to log under (for ident). More... | |
static int | sysvar_check_fac (MYSQL_THD thd, SYS_VAR *self, void *save, struct st_mysql_value *value) |
System-variable: Check proposed value for component variable controlling facility to log under. More... | |
static void | sysvar_update_fac (MYSQL_THD thd, SYS_VAR *self, void *var_ptr, const void *save) |
System-variable: Update value of component variable controlling facilty to log under Updates internal state as needed. More... | |
static int | sysvar_install_fac (void) |
Set up system variable containing the tag to log under (for ident). More... | |
static void | sysvar_update_pid (MYSQL_THD thd, SYS_VAR *self, void *var_ptr, const void *save) |
System-variable: Update value of component variable governing inclusion of process ID (pid) Updates internal state as needed. More... | |
static int | sysvar_install_pid (void) |
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_syseventlog, log_service) | |
END_COMPONENT_PROVIDES () | |
REQUIRES_SERVICE (component_sys_variable_register) | |
REQUIRES_SERVICE (component_sys_variable_unregister) | |
REQUIRES_SERVICE (log_builtins) | |
REQUIRES_SERVICE (log_builtins_string) | |
REQUIRES_SERVICE (log_builtins_syseventlog) | |
END_COMPONENT_REQUIRES () | |
METADATA ("mysql.author", "Oracle Corporation") | |
METADATA ("mysql.license", "GPL") | |
METADATA ("log_service_type", "sink") | |
END_COMPONENT_METADATA () | |
Variables | |
static SYSLOG_FACILITY | syslog_facility [] |
static bool | inited = false |
component initialized More... | |
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_builtins_syseventlog_t * | log_se = nullptr |
static int | log_syslog_facility = LOG_DAEMON |
facility we're syslogging to More... | |
static bool | log_syslog_include_pid = true |
log process ID More... | |
static char * | log_syslog_ident = nullptr |
ident we're using (see "tag") More... | |
static bool | log_syslog_enabled = false |
logging engaged More... | |
static char * | buffer_tag = nullptr |
sysvar containing tag, if any More... | |
static char * | buffer_fac = nullptr |
sysvar containing fac, if any More... | |
const mysql_service_log_service_t | imp_log_sink_syseventlog_log_service |
mysql_component_t | mysql_component_log_sink_syseventlog |
#define LOG_DAEMON_NAME "daemon" |
#define LOG_TYPE "syslog" |
#define MAX_FAC_LEN 32 |
#define MAX_TAG_LEN 32 |
#define MY_NAME "syseventlog" |
#define OPT_FAC "facility" |
#define OPT_PID "include_pid" |
#define OPT_TAG "tag" |
#define PREFIX "mysqld" |
BOOL_CHECK_ARG | ( | pid | ) |
syslog default PID state
END_COMPONENT_METADATA | ( | ) |
END_COMPONENT_PROVIDES | ( | ) |
END_COMPONENT_REQUIRES | ( | ) |
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 |
|
static |
Close POSIX syslog / Windows EventLog.
0 | On Success. |
!=0 | On failure. |
void log_syslog_exit | ( | void | ) |
Stop using syslog / EventLog.
Call as late as possible.
|
static |
On being handed a syslog facility name tries to look it up.
If successful, fills in a struct with the facility ID and the facility's canonical name.
f | Name of the facility we're trying to look up. Lookup is case-insensitive; leading "log_" is ignored. | |
[out] | rsf | A buffer in which to return the ID and canonical name. |
false | No errors; buffer contains valid result |
true | Something went wrong, no valid result set returned |
int log_syslog_open | ( | ) |
Open POSIX syslog / Windows EventLog.
-3 | log already open, close it before opening again! (log still open) |
-2 | cannot set up new registry entry, continuing with previous value (log still open, but continues to log under previous key) |
-1 | cannot set up new registry entry, no previous value (log not opened) |
0 | success (log opened) |
|
static |
Syslog settings have changed; close and re-open.
METADATA | ( | "log_service_type" | , |
"sink" | |||
) |
METADATA | ( | "mysql.author" | , |
"Oracle Corporation" | |||
) |
METADATA | ( | "mysql.license" | , |
"GPL" | |||
) |
PROVIDES_SERVICE | ( | log_sink_syseventlog | , |
log_service | |||
) |
REQUIRES_SERVICE | ( | component_sys_variable_register | ) |
REQUIRES_SERVICE | ( | component_sys_variable_unregister | ) |
REQUIRES_SERVICE | ( | log_builtins | ) |
REQUIRES_SERVICE | ( | log_builtins_string | ) |
REQUIRES_SERVICE | ( | log_builtins_syseventlog | ) |
REQUIRES_SERVICE_PLACEHOLDER | ( | component_sys_variable_register | ) |
REQUIRES_SERVICE_PLACEHOLDER | ( | component_sys_variable_unregister | ) |
REQUIRES_SERVICE_PLACEHOLDER | ( | log_builtins | ) |
REQUIRES_SERVICE_PLACEHOLDER | ( | log_builtins_string | ) |
REQUIRES_SERVICE_PLACEHOLDER | ( | log_builtins_syseventlog | ) |
STR_CHECK_ARG | ( | fac | ) |
syslog default facility
STR_CHECK_ARG | ( | tag | ) |
syslog default tag
|
static |
System-variable: Check proposed value for component variable controlling facility to log under.
Queries internal state as needed.
thd | session |
self | the system variable we're checking |
save | where to save the resulting intermediate (char *) value |
value | the value we're validating |
false | value OK, go ahead and update system variable (from "save") |
true | value rejected, do not update variable |
|
static |
System-variable: Check proposed value for component variable controlling tag to log under.
Queries internal state as needed.
thd | session |
self | the system variable we're checking |
save | where to save the resulting intermediate (char *) value |
value | the value we're validating |
false | value OK, go ahead and update system variable (from "save") |
true | value rejected, do not update variable |
|
static |
Set up system variable containing the tag to log under (for ident).
0 | success |
-1 | failure |
|
static |
|
static |
Set up system variable containing the tag to log under (for ident).
0 | success |
-1 | failure |
|
static |
System-variable: Update value of component variable controlling facilty to log under Updates internal state as needed.
thd | session |
self | the system variable we're changing |
var_ptr | where to save the resulting (char *) value |
save | pointer to the new value (from check function) |
|
static |
System-variable: Update value of component variable governing inclusion of process ID (pid) Updates internal state as needed.
thd | session |
self | the system variable we're changing |
var_ptr | where to save the resulting (char *) value |
save | pointer to the new value (from check function) |
|
static |
System-variable: Update value of component variable controlling tag to log under Updates internal state as needed.
thd | session |
self | the system variable we're changing |
var_ptr | where to save the resulting (char *) value |
save | pointer to the new value (from check function) |
|
static |
Internal state: Validate facility to log under.
fac | a string containing the facility |
0 | no complaints |
-1 | unknown facility |
-2 | facility name exceeds buffer |
|
static |
Internal state: Validate new tag to log under.
tag | a string containing the tag |
0 | no complaints |
-1 | no argument |
1 | invalid argument |
|
static |
Internal state: Update facility to log under May change facility to its canonical representation if needed.
fac | new facility to log under |
0 | success |
|
static |
Internal state: Toggle inclusion of process ID (pid)
inc_pid | include PID? |
0 | success |
|
static |
Internal state: Update tag to log under.
tag | new tag to log under (will be appended to PREFIX) |
0 | success |
-1 | EINVAL |
-2 | out of memory |
|
static |
sysvar containing fac, if any
|
static |
sysvar containing tag, if any
const mysql_service_log_service_t imp_log_sink_syseventlog_log_service |
|
static |
component initialized
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_builtins_syseventlog_t* log_se = nullptr |
|
static |
logging engaged
|
static |
facility we're syslogging to
|
static |
ident we're using (see "tag")
|
static |
log process ID
mysql_component_t mysql_component_log_sink_syseventlog |
|
static |