Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

Beck avatar image
Beck asked Erick Ramirez commented

How to see the cql query being executed?

Hi all,


I am researching about this question.


I had tried that way: DataStax Java Driver for Apache Cassandra User Mailing List ›How to see the cql query being executed?


I just modified the logback.xml:

<logger name="com.datastax.driver.core.QueryLogger.NORMAL" level="ALL"/>


I checked "system.log" and "debug.log", and I can't find any CQL statement.


Environment and Step:

1.docker run -e DS_LICENSE=accept -p 9042:9042 --name my-dse -d datastax/dse-server:6.7.2

2.docker cp logback.xml my-dse:/opt/dse/resources/cassandra/conf/logback.xml

3.docker stop my-dse

4.docker start my-dse

5.docker exec -it my-dse cqlsh

6.execute some cql statement.

7.check the system.log and debug.log.


Attachment is my full logback.xml:logback.xml



How to see the cql query?

cassandralogback.xmlquerylogger
logback.xml (8.7 KiB)
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez commented

You want to enable the Database Auditing feature that is only available in DataStax Enterprise. It captures auditable events to either a log file or Cassandra table. There are different event types/categories you can audit including DML, DDL and/or authentication. Cheers!

4 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Got it!

It's work! Thanks!

1 Like 1 ·

Good to know, at the same time sad that it works only with Datastax Enterprise. We are using community version and always would like to know about running queries.

0 Likes 0 ·

Thanks for the feedback, @sparikh71_28533. It's an enterprise feature we added in DSE. Cheers!

0 Likes 0 ·

Glad to help. I would appreciate it if you could "accept" my answer so it gets rated. Cheers!

-1 Like -1 ·