Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Sync "connection" properties in logs
Browse files Browse the repository at this point in the history
- Use the same json property for connection ids in both types of logs
- Minor non functional formatting changes
  • Loading branch information
travispaul committed Apr 4, 2018
1 parent 026ccbd commit eca30bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Table access queries are logged as ``"type": "query"``:
Any changes to the plugin's variables are logged as ``"type": "set_global"``:

```
{"time":"2018-04-02 07:26:23", "type":"set_global", "user":"user@host", "connection": 123, "variable":"query_audit_log_databases", "value":"inventory,wiki"}
{"time":"2018-04-02 07:26:23", "type": "set_global", "user": "user@host", "connection": 123, "variable": "query_audit_log_databases", "value": "inventory,wiki"}
```

## Installation
Expand Down
14 changes: 7 additions & 7 deletions src/query_audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ query_audit_plugin_init(MYSQL_PLUGIN plugin) {
}

static int
query_audit_plugin_deinit(void *arg MY_ATTRIBUTE((unused))) {
query_audit_plugin_deinit(void * arg MY_ATTRIBUTE((unused))) {

my_plugin_log_message(&query_audit_plugin, MY_INFORMATION_LEVEL, "Shutting down");

Expand Down Expand Up @@ -207,7 +207,7 @@ query_audit_write_gvar_log(const struct mysql_event_global_variable * event_glob

root = query_audit_get_json_log("set_global", thd);

cJSON_AddItemToObject(root, "cnx_id", cJSON_CreateNumber(event_global_var->connection_id));
cJSON_AddItemToObject(root, "connection", cJSON_CreateNumber(event_global_var->connection_id));

cJSON_AddItemToObject(root, "variable", cJSON_CreateString(event_global_var->variable_name.str));

Expand All @@ -228,7 +228,7 @@ query_audit_write_gvar_log(const struct mysql_event_global_variable * event_glob
}

static int
query_audit_notify(MYSQL_THD thd, mysql_event_class_t event_class, const void *event) {
query_audit_notify(MYSQL_THD thd, mysql_event_class_t event_class, const void * event) {

const struct mysql_event_connection * event_connection;
const struct mysql_event_table_access * event_table;
Expand Down Expand Up @@ -279,7 +279,7 @@ query_audit_notify(MYSQL_THD thd, mysql_event_class_t event_class, const void *e
static void
update_always_fflush(MYSQL_THD thd __attribute__((unused)),
struct st_mysql_sys_var * var __attribute__((unused)),
void *var_ptr __attribute__((unused)), const void * save) {
void * var_ptr __attribute__((unused)), const void * save) {

log_mutex_lock(&lock_operations);

Expand All @@ -294,7 +294,7 @@ update_always_fflush(MYSQL_THD thd __attribute__((unused)),
static void
update_log_file(MYSQL_THD thd __attribute__((unused)),
struct st_mysql_sys_var * var __attribute__((unused)),
void *var_ptr __attribute__((unused)), const void *save) {
void * var_ptr __attribute__((unused)), const void * save) {

char *new_log_file;

Expand Down Expand Up @@ -327,7 +327,7 @@ update_log_file(MYSQL_THD thd __attribute__((unused)),
static void
update_log_tables(MYSQL_THD thd __attribute__((unused)),
struct st_mysql_sys_var * var __attribute__((unused)),
void *var_ptr __attribute__((unused)), const void *save) {
void * var_ptr __attribute__((unused)), const void * save) {

char * new_tables;
int i;
Expand Down Expand Up @@ -368,7 +368,7 @@ update_log_tables(MYSQL_THD thd __attribute__((unused)),
static void
update_log_databases(MYSQL_THD thd __attribute__((unused)),
struct st_mysql_sys_var * var __attribute__((unused)),
void *var_ptr __attribute__((unused)), const void *save) {
void * var_ptr __attribute__((unused)), const void * save) {

char * new_databases;
int i;
Expand Down

0 comments on commit eca30bc

Please sign in to comment.