Skip to content

Trying to log both user logins and quits but only logs quits #64

@clownred

Description

@clownred

Hi,

Great plugin and appreciate having it available for MySQL.

I am having an issue with the plugin not logging user connections - when a user logs into mysql with "mysql -umyuser -p" etc, I want to log both user logins and quits/logouts. With the following in my cnf file it logs quits successfully but not user logins :-

audit_record_cmds="Quit, connect"

I have tried using "Connect" instead of "connect", with quotes and without quotes, without success. Note that if I comment out "audit_record_cmds" from the cnf file and restart, then the plugin will successfully log both user logins and quits/logouts. The problem with that is that I want to control and limit what it logs rather than logging everything.

Am I doing something wrong, is this possible.

Note that I did not do the offsets steps when I installed the plugin since my MySQL version is standard. I am assuming that since the plugin is active, the default offsets worked ok.

CNF file entries

plugin-load=AUDIT=libaudit_plugin.so
audit_json_file=1
audit_record_cmds="Quit, connect"

OUTPUT FROM ERROR LOG WHEN START MYSQL

131206 22:12:44 [Note] Plugin 'FEDERATED' is disabled.
131206 22:12:44 [Note] Audit Plugin: Set interface version to: 12839424 (50154)
131206 22:12:44 InnoDB: Initializing buffer pool, size = 200.0M
131206 22:12:44 InnoDB: Completed initialization of buffer pool
131206 22:12:44 InnoDB: Started; log sequence number 0 409383309
131206 22:12:44 [Note] Audit Plugin: starting up. Version: 1.0.3 , Revision: 371 (64bit). AUDIT plugin interface version: 50154. MySQL Server version: 5.1.54-1ubuntu4-log.
131206 22:12:44 [Note] Audit Plugin: setup_offsets audit_offsets: (null) validate_checksum: 1 offsets_by_version: 1
131206 22:12:45 [Note] Audit Plugin: mysqld: /usr/sbin/mysqld (ab2cb4399ee0306c0822a9a682f03bf4)
131206 22:12:45 [ERROR] Audit Plugin: Offsets: 5.1.54-community (c23b86ac2f64e9de6731fef97e79c98e) match thread validation check fails with value: 0. Skipping offest.
131206 22:12:45 [ERROR] Audit Plugin: Offsets: 5.1.54-community (c23b86ac2f64e9de6731fef97e79c98e) match thread validation check fails with value: 0. Skipping offest.
131206 22:12:45 [Note] Audit Plugin: extended offsets validate res: MySQL thread id 123456, query id 789 aud_tusr
131206 22:12:45 [Note] Audit Plugin: Using offsets from offset version: 5.1.54 (9fca5d956c33e646920e68c541aabcae)
131206 22:12:45 [Note] Audit Plugin: Set num_record_cmds: 2
131206 22:12:45 [Note] Audit Plugin: mem func addr: 0x7fc427031b00 mem start addr: 0x7fc427032000 page size: 4096
131206 22:12:45 [Note] Audit Plugin: hot patching function: 0x7fc427522730, trampolineFunction: 0x7fc427032000 trampolinePage: 0x7fc427032000
131206 22:12:45 [Note] Audit Plugin: hot patch for: log_slow_statement (0x7fc427522730) complete. Audit func: 0x7fc427031650, Trampoline address: 0x7fc427032000 size: 14.
131206 22:12:45 [Note] Audit Plugin: hot patching function: 0x7fc427528120, trampolineFunction: 0x7fc427032020 trampolinePage: 0x7fc427032000
131206 22:12:45 [Note] Audit Plugin: hot patch for: mysql_execute_command (0x7fc427528120) complete. Audit func: 0x7fc427031470, Trampoline address: 0x7fc427032020 size: 18.
131206 22:12:45 [Note] Audit Plugin: hot patching function: 0x7fc427520860, trampolineFunction: 0x7fc427032040 trampolinePage: 0x7fc427032000
131206 22:12:45 [Note] Audit Plugin: hot patch for: check_user (0x7fc427520860) complete. Audit func: 0x7fc4270316c0, Trampoline address: 0x7fc427032040 size: 17.
131206 22:12:45 [Note] Audit Plugin: hot patching function: 0x7fc427655080, trampolineFunction: 0x7fc427032060 trampolinePage: 0x7fc427032000
131206 22:12:45 [Note] Audit Plugin: hot patch for: send_result_to_client (0x7fc427655080) complete. Audit func: 0x7fc427031150, Trampoline address: 0x7fc427032060 size: 18.
131206 22:12:45 [Note] Audit Plugin: hot patching function: 0x7fc427523aa0, trampolineFunction: 0x7fc427032080 trampolinePage: 0x7fc427032000
131206 22:12:45 [Note] Audit Plugin: hot patch for: check_table_access (0x7fc427523aa0) complete. Audit func: 0x7fc427030f90, Trampoline address: 0x7fc427032080 size: 14.
131206 22:12:45 [Note] Audit Plugin: hot patching function: 0x7fc42756ba40, trampolineFunction: 0x7fc4270320a0 trampolinePage: 0x7fc427032000
131206 22:12:45 [Note] Audit Plugin: hot patch for: open_tables (0x7fc42756ba40) complete. Audit func: 0x7fc427031220, Trampoline address: 0x7fc4270320a0 size: 15.
131206 22:12:45 [Note] Audit Plugin: Init completed successfully.
131206 22:12:45 [Note] Event Scheduler: Loaded 0 events
131206 22:12:45 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.54-1ubuntu4-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu)
131206 22:12:45 [Note] Audit Plugin: thd_query_string_func: 0x7fc4275064f0

VERSION INFO

mysql> status

mysql Ver 14.14 Distrib 5.1.63, for debian-linux-gnu (x86_64) using readline 6.2

Connection id: 34
Current database:
Current user: debian-sys-maint@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.1.54-1ubuntu4-log (Ubuntu)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 5 min 17 sec

Threads: 1 Questions: 101 Slow queries: 1 Opens: 315 Flush tables: 1 Open tables: 77 Queries per second avg: 0.318

mysql> select version();
+---------------------+
| version() |
+---------------------+
| 5.1.54-1ubuntu4-log |
+---------------------+
1 row in set (0.00 sec)

mysql> show global status like 'AUDIT_version';
+---------------+-----------+
| Variable_name | Value |
+---------------+-----------+
| AUDIT_version | 1.0.3-371 |
+---------------+-----------+

PLUGIN STATUS

mysql> show plugins;
+------------+----------+----------------+--------------------+---------+
| Name | Status | Type | Library | License |
+------------+----------+----------------+--------------------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |
| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| FEDERATED | DISABLED | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| AUDIT | ACTIVE | DAEMON | libaudit_plugin.so | GPL |
+------------+----------+----------------+--------------------+---------+

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions