MySQL audit: Only Log Successfully Executed Statements on a specific table


set @f='
{
    "filter": {
        "id": "main",
        "class": [
            {
                "name": "table_access_data",
                "event": {
                    "name": [
                        "insert",
                        "update",
                        "delete"
                    ],
                    "log": false,
                    "filter": {
                        "activate": {
                            "and": [
                                {
                                    "field": {
                                        "name": "table_database.str",
                                        "value": "db1"
                                    }
                                },
                                {
                                    "field": {
                                        "name": "table_name.str",
                                        "value": "tb1"
                                    }
                                }
                            ]
                        },
                        "class": {
                            "name": "general",
                            "event": {
                                "name": "status",
                                "log": {
                                    "field": {
                                        "name": "general_error_code",
                                        "value": 0
                                    }
                                },
                                "filter": {
                                    "ref": "main"
                                }
                            }
                        }
                    }
                }
            }
        ]
    }
}';
SELECT audit_log_filter_set_filter('log_goyuninfo', @f); 
SELECT audit_log_filter_set_user('%', 'log_goyuninfo');

Comments