We are using Apache Phoenix to access an HBase data store. As part of some requirements, we need to log every update operation, such as write and drop table commands, issued from any Phoenix client. Does Phoenix's logging already capture these commands in a parseable format? If not, how could I capture this information?
1 Answers
0
votes
*Assumption you are using PQS * Depending on the version you use, you can turn on tracing in 4.8 and higher.
If you are on 4.7 and lower, you can use an intermediate/reverse proxy, such as nginx
log_format postdata '$request_time $msec $remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" "$request_body"';
From a post I did, http://bastide.org/2017/01/18/logging-using-pqs-lower-than-4-6/
You can then filter using regex on the log and looking at the ProtoBuf Object, or you can look at filtering in the log using regex in the nginx config.
For versions higher than 4.7, you can use a log4j properties configuration file and turn on logging for PreparedStatement/Statement -Dlog4j.configuration=file:///tmp/log4j.properties