Audit log in Cassandra 2.2.8 community edition

房东的猫 提交于 2019-12-25 11:59:29

问题


Is there any way to log queries along with user that executed the query in Cassandra community edition?

I'm looking for a Server level solution, not driver/client based solution

Thanks!


回答1:


Try nodetool settraceprobability

nodetool settraceprobability <value>

Sets the probability for tracing a request.

  • Value is a probability between 0 and 1.

Tracing a request usually requires at least 10 rows to be inserted. A probability of 1.0 will trace everything whereas lesser amounts (for example, 0.10) only sample a certain percentage of statements.

The trace information is stored in a system_traces keyspace that holds two tables – sessions and events, which can be easily queried to answer questions, such as what the most time-consuming query has been since a trace was started. Query the parameters map and thread column in the system_traces.sessions and events tables for probabilistic tracing information.

Note : Care should be taken on large and active systems, as system-wide tracing will have a performance impact. Unless you are under very light load, tracing all requests (probability 1.0) will probably overwhelm your system

If you don't want to use this, then you have log the query from the client side How to use Query Logger ?. There is no other way

Source : https://docs.datastax.com/en/cassandra/2.1/cassandra/tools/toolsSetTraceProbability.html



来源:https://stackoverflow.com/questions/46607413/audit-log-in-cassandra-2-2-8-community-edition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!