diff --git a/audit/audit.cc b/audit/audit.cc index 5d3744781c..9b014a810e 100644 --- a/audit/audit.cc +++ b/audit/audit.cc @@ -304,7 +304,7 @@ future<> inspect_login(const sstring& username, socket_address client_ip, bool e return audit::local_audit_instance().log_login(username, client_ip, error); } -bool audit::should_log_table(const sstring& keyspace, const sstring& name) const { +bool audit::should_log_table(std::string_view keyspace, std::string_view name) const { auto keyspace_it = _audited_tables.find(keyspace); return keyspace_it != _audited_tables.cend() && keyspace_it->second.find(name) != keyspace_it->second.cend(); } @@ -319,8 +319,8 @@ bool audit::will_log(statement_category cat, std::string_view keyspace, std::str // so it is logged whenever the category matches. return _audited_categories.contains(cat) && (keyspace.empty() - || _audited_keyspaces.find(sstring(keyspace)) != _audited_keyspaces.cend() - || should_log_table(sstring(keyspace), sstring(table)) + || _audited_keyspaces.find(keyspace) != _audited_keyspaces.cend() + || should_log_table(keyspace, table) || cat == statement_category::AUTH || cat == statement_category::ADMIN || cat == statement_category::DCL); diff --git a/audit/audit.hh b/audit/audit.hh index bf81cdd607..2b482d2047 100644 --- a/audit/audit.hh +++ b/audit/audit.hh @@ -150,7 +150,7 @@ private: template void update_config(const sstring & new_value, std::function parse_func, T& cfg_parameter); - bool should_log_table(const sstring& keyspace, const sstring& name) const; + bool should_log_table(std::string_view keyspace, std::string_view name) const; public: static seastar::sharded& audit_instance() { // FIXME: leaked intentionally to avoid shutdown problems, see #293