| 396 | |
| 397 | |
| 398 | static String prepareQueryForLogging(const String & query, ContextPtr context) |
| 399 | { |
| 400 | String res = query; |
| 401 | |
| 402 | // wiping sensitive data before cropping query by log_queries_cut_to_length, |
| 403 | // otherwise something like credit card without last digit can go to log |
| 404 | if (auto * masker = SensitiveDataMasker::getInstance()) |
| 405 | { |
| 406 | auto matches = masker->wipeSensitiveData(res); |
| 407 | if (matches > 0) |
| 408 | { |
| 409 | ProfileEvents::increment(ProfileEvents::QueryMaskingRulesMatch, matches); |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | res = res.substr(0, context->getSettingsRef().log_queries_cut_to_length); |
| 414 | |
| 415 | return res; |
| 416 | } |
| 417 | |
| 418 | |
| 419 | /// Log query into text log (not into system table). |
no test coverage detected