With a large volume of queries per second logging all queries gets expensive, it would be nice to be able to log only a configurable fraction of the queries, selected at random.
{
    String res = query;
    
    
    if (auto * masker = SensitiveDataMasker::getInstance())
    {
        auto matches = masker->wipeSensitiveData(res);
        if (matches > 0)
        {
            ProfileEvents::increment(ProfileEvents::QueryMaskingRulesMatch, matches);
        }
    }
    res = res.substr(0, context->getSettingsRef().log_queries_cut_to_length);
    return res;
}
static void logQuery(const String & query, ContextPtr context, bool internal)