Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to open audit log in MariaDB10.1

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Today I will show you how to open the audit log in MariaDB10.1. The content of the article is good. Now I would like to share it with you. Friends who feel in need can understand it. I hope it will be helpful to you. Let's read it along with the editor's ideas.

MariaDB log audit

Part1: who did it?

People who do DBA often encounter that some tables have been misoperated, truncate, delete, or even drop. Most of the reasons for this are due to the problem of artificial + permissions. Some public accounts, such as ceshi accounts, can be operated by everyone, and because of the misoperation caused by these public accounts, you yell in the office, "who deleted my watch?" 80% no one will respond to you.

Audit log function, which is mainly implemented in MariaDB10.0/10.1 and Percona 5.6version. This feature is also supported in MySQL5.6/5.7 Enterprise Edition. The following mainly describes and demonstrates how to open the audit log in MariaDB10.1.

Part2: build environment

In this article, we use version 10.1.16 of MariaDB. Of course, other versions of MariaDB can be used. How to install the MariaDB database environment will not be discussed in detail in this article. If necessary, the steps can be moved:

Http://suifu.blog.51cto.com/9167728/1830575

Here is how to install the audit Audit Plugin plug-in in MariaDB10.1.16

Execute the following command in the MariaDB database:

NSTALL PLUGIN server_audit SONAME 'server_audit.so'

The specific code is shown in the following figure.

Warning: warning

It is worth noting here that the name server_audit.so is not random because it reads the file in the / usr/local/mariadb/lib/plugin directory, and if you specify it as mariadb-audit.so, you will throw the following error because there is no such file in the plugin directory.

Part2: parameter interpretation

Server_audit_events='CONNECT,QUERY,TABLE' represents the IP, user name, and DML/DDL/DCL operation of the table linked to Huiji Road.

Server_audit_logging=ON means to enable the audit log service.

Server_audit_excl_users=helei means that only all actions of the helei user are recorded.

Server_audit_file_rotate_size=1G means that if the defined 1GB is exceeded, the log will automatically rotate training.

Server_audit_file_path=server_audit.log represents the path to the audit log.

More related parameters can be viewed using show variables like 'server_audit%';, as shown in the following figure.

Part3: enable relevant parameters

Server_audit_events, server_audit_logging and other parameters are global dynamic parameters, which can be changed directly in the database. The command is as follows:

Set global server_audit_events='CONNECT,QUERY,TABLE'

Set global server_audit_logging=ON

Part4: check the effect

After enabling the relevant parameters, you do not need to restart the database, you can directly see that the relevant operations have been recorded to server_audit.log, as shown in the following figure.

These are all the contents of how to open the audit log in MariaDB10.1. For more information about how to open the audit log in MariaDB10.1, you can search the previous articles or browse the following articles to learn! I believe the editor will add more knowledge to you. I hope you can support it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report