# Please don't modify this file as your changes might be overwritten with
# the next update.
#
# You can modify '$LOCAL_CONFDIR/rspamd.conf.local.override' to redefine
# parameters defined on the top level
#
# You can modify '$LOCAL_CONFDIR/rspamd.conf.local' to add
# parameters defined on the top level
#
# For specific modules or configuration you can also modify
# '$LOCAL_CONFDIR/local.d/file.conf' - to add your options or rewrite defaults
# '$LOCAL_CONFDIR/override.d/file.conf' - to override the defaults
#
# See https://rspamd.com/doc/tutorials/writing_rules.html for details


clickhouse {
  # Push update when 1000 records are collected (1000 if unset)
  limit = 1000;
  # IP:port of Clickhouse server
  # server = "localhost:8123";
  # Timeout to wait for response (5 seconds if unset)
  timeout = 5;
  # How many bits of sending IP to mask in logs for IPv4 (19 if unset)
  ipmask = 19;
  # How many bits of sending IP to mask in logs for IPv6 (48 if unset)
  ipmask6 = 48;
  # Record URL paths? (default false)
  full_urls = false;
  # This parameter points to a map of domain names
  # If a message has a domain in this map in From: header and DKIM signature,
  # record general metadata in a table named after the domain
  #from_tables = "/etc/rspamd/clickhouse_from.map";
  # These are tables used to store data in Clickhouse
  # Table used to store ASN information (default unset: not collected)
  #asn_table = "rspamd_asn"; # default unset
  # The following table names are set by default
  # Set these if you use want to use different table names
  #table = "rspamd"; # general metadata
  #attachments_table = "rspamd_attachments"; # attachment metadata
  #urls_table = "rspamd_urls"; # url metadata
  # These are symbols of other checks in Rspamd
  # Set these if you use non-default symbol names (unlikely)
  #bayes_spam_symbols = ["BAYES_SPAM"];
  #bayes_ham_symbols = ["BAYES_HAM"];
  #fann_symbols = ["FANN_SCORE"];
  #fuzzy_symbols = ["FUZZY_DENIED"];
  #whitelist_symbols = ["WHITELIST_DKIM", "WHITELIST_SPF_DKIM", "WHITELIST_DMARC"];
  #dkim_allow_symbols = ["R_DKIM_ALLOW"];
  #dkim_reject_symbols = ["R_DKIM_REJECT"];
  #dmarc_allow_symbols = ["DMARC_POLICY_ALLOW"];
  #dmarc_reject_symbols = ["DMARC_POLICY_REJECT", "DMARC_POLICY_QUARANTINE"];

  #retention {
  #  # disabled by default
  #  enable = true;
  #  # drop | detach, please refer to ClickHouse docs for details
  #  # http://clickhouse-docs.readthedocs.io/en/latest/query_language/queries.html#manipulations-with-partitions-and-parts
  #  method = "drop";
  #  # how many month the data should be kept in ClickHouse
  #  period_months = 3;
  #  # how often run the cleanup process
  #  run_every = "7d";
  #}

  .include(try=true,priority=5) "${DBDIR}/dynamic/clickhouse.conf"
  .include(try=true,priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/clickhouse.conf"
  .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/clickhouse.conf"
}
