Cassandra 2.2.8社区版中的审核日志 [英] Audit log in Cassandra 2.2.8 community edition
问题描述
是否可以与在Cassandra社区版中执行查询的用户一起记录查询?
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
谢谢!
推荐答案
尝试使用nodetool settraceprobability
nodetool settraceprobability <value>
设置跟踪请求的可能性。
Sets the probability for tracing a request.
- 值是介于0和1之间的概率。
跟踪请求通常至少需要插入10行。
概率为1.0会跟踪所有内容,而较少的数量(例如0.10)仅对一定百分比的语句进行采样。
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.
跟踪信息存储在system_traces键空间中,该键空间包含两个表-会话和事件,可以很容易地查询它们以回答问题,例如最耗时的时间自跟踪开始以来一直进行查询。在system_traces.sessions和events表中查询参数map和thread列以获取概率跟踪信息。
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.
注意:应注意大型活动系统应采用此方法,因为整个系统的跟踪都会对性能产生影响。除非您的负载很轻,否则跟踪所有请求(概率1.0)可能会使您的系统不知所措
如果您不想使用此功能,那么您已经从客户端如何使用查询记录器记录了查询?。没有其他方法
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
来源: https://docs.datastax.com/en/cassandra/2.1/cassandra/tools/toolsSetTraceProbability.html
这篇关于Cassandra 2.2.8社区版中的审核日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!