# This file managed by Chef. Do not edit directly. 

######### general stuff #############

# choose where to produce data to. currently this is one of: stdout|file|kafka|kinesis|pubsub|rabbitmq|redis
producer=<%= node['maxwell']['producer'] %>

# set the log level.  note that you can configure things further in log4j2.xml
log_level=<%= node['maxwell']['log_level'] %>

######### mysql stuff ###############

# mysql host to connect to
host=<%= node['maxwell']['mysql']['host'] %>

# mysql port to connect to
port=<%= node['maxwell']['mysql']['port'] %>

# mysql user to connect as. This user must have REPLICATION SLAVE permissions,
# as well as full access to the `maxwell` (or schema_database) database
user=<%= node['maxwell']['mysql']['user'] %>

# mysql password
password=<%= node['maxwell']['mysql']['password'] %>

# client id (must be unique)
client_id=<%= node['maxwell']['mysql']['client_id'] %>

# replica id (must be unique between instances connecting to same mysql host)
replica_server_id=<%= node['maxwell']['mysql']['replica_server_id'] %>

# options to pass into the jdbc connection, given as opt=val&opt2=val2
jdbc_options=<%= node['maxwell']['mysql']['jdbc_options'] %>

# options to pass into the schema jdbc connection, given as opt=val&opt2=val2
schema_jdbc_options=<%= node['maxwell']['mysql']['schema_jdbc_options'] %>

# options to pass into the replication jdbc connection, given as opt=val&opt2=val2
replication_jdbc_options=<%= node['maxwell']['mysql']['replication_jdbc_options'] %>

# name of the mysql database where maxwell keeps its own state
schema_database=<%= node['maxwell']['mysql']['schema_database'] %>

# maxwell can optionally replicate from a different server than where it stores
# schema and binlog position info.  Specify that different server here. If not set, fall back to default mysql settings:
replication_host=<%= node['maxwell']['mysql']['replication_host'] || node['maxwell']['mysql']['host'] %>
replication_user=<%= node['maxwell']['mysql']['replication_user'] || node['maxwell']['mysql']['user'] %>
replication_password=<%= node['maxwell']['mysql']['replication_password'] || node['maxwell']['mysql']['password'] %>
replication_port=<%= node['maxwell']['mysql']['replication_port'] || node['maxwell']['mysql']['port'] %>

######### output format stuff ###############

# records include binlog position (default false)
output_binlog_position=<%= node['maxwell']['output']['output_binlog_position'] %>

# records output null values (default true)
output_nulls=<%= node['maxwell']['output']['output_nulls'] %>

# records include server_id (default false)
output_server_id=<%= node['maxwell']['output']['output_server_id'] %>

# records include thread_id (default false)
output_thread_id=<%= node['maxwell']['output']['output_thread_id'] %>

# records include commit and xid (default true)
output_commit_info=<%= node['maxwell']['output']['output_commit_info'] %>

# produce DDL records to ddl_kafka_topic (default: false)
output_ddl=<%= node['maxwell']['output']['output_ddl'] %>

<% if node['maxwell']['producer'] == 'kafka' %>
######### kafka stuff ###############

# list of kafka brokers
kafka.bootstrap.servers=<%= node['maxwell']['kafka']['bootstrap_servers'] %>

# kafka topic to write to
# this can be static, e.g. 'maxwell', or dynamic, e.g. namespace_%{database}_%{table}
# in the latter case 'database' and 'table' will be replaced with the values for the row being processed
kafka_topic=<%= node['maxwell']['kafka']['topic'] %>

# kafka topic to write DDL to
ddl_kafka_topic=<%= node['maxwell']['kafka']['ddl_kafka_topic'] %>

# hash function to use.  "default" is just the JVM's 'hashCode'
# function.
# [default, murmur3]
kafka_partition_hash=<%= node['maxwell']['kafka']['partition_hash'] %>

# how maxwell writes its kafka key.
#
# 'hash' looks like:
# {"database":"test","table":"tickets","pk.id":10001}
#
# 'array' looks like:
# ["test","tickets",[{"id":10001}]]
#
# currently the default is "hash"
# [hash, array]
kafka_key_format=<%= node['maxwell']['kafka']['key_format'] %>

# other kafka options.  Anything prefixed "kafka." will get
# passed directly into the kafka-producer's config.
kafka.batch.size=<%= node['maxwell']['kafka']['batch_size'] %>

# a few defaults.
# These are 0.9-specific. They may or may not work with other versions.
kafka.compression.type=<%= node['maxwell']['kafka']['compression_type'] %>
kafka.metadata.fetch.timeout.ms=<%= node['maxwell']['kafka']['metadata_fetch_timeout'] %>
kafka.retries=<%= node['maxwell']['kafka']['retries'] %>
kafka.acks=<%= node['maxwell']['kafka']['acks'] %>

# Maxwells supports extended kafka options (reference: http://maxwells-daemon.io/producers/#extended-options)
# So allow a hash of arbitrary length
<% unless node['maxwell']['kafka']['extended_options'].empty? %>
<% Hash(node['maxwell']['kafka']['extended_options']).each do |option, value| %>
kafka.<%= option %>=<%= value %>
<% end %>
<% end -%>

<% end %>

<% if node['maxwell']['producer'] =~ /kafka|kinesis/ %>
####### producer partitioning #######
# used by kafka and kinesis

# controls the input input into the hash function.  Note that this defines
# which transactions keep ordering with respect to each other.  Generally
# here you're making a trade-off between inter-row consistency and balanced
# partitions.
# can be any one of [database, table, primary_key, column]
producer_partition_by=<%= node['maxwell']['partition']['partition_by'] %>

# required when using producer_partition_by=column
# otherwise the partitioner will revert to table
# can be a single or multiple columns, e.g. aggregate_id or aggregate_id,event_type
producer_partition_columns=<%= node['maxwell']['partition']['partition_columns'] %>

# required when using producer_partition_by=column
# the fallback partitioning behavior when the specified column(s) do not exist
# can be any one of [database, table, primary_key]
producer_partition_by_fallback=<%= node['maxwell']['partition']['partition_by_fallback'] %>

# Maxwell will be terminated on kafka/kinesis errors when false.
# Otherwise, those producer errors are only logged.
ignore_producer_error=<%= node['maxwell']['ignore_producer_error'] %>
<% end %>

<% if node['maxwell']['producer'] == 'kinesis' %>
######### kinesis ####################

kinesis_stream=<%= node['maxwell']['kinesis']['stream'] %>

# AWS places a 256 unicode character limit on the max key length of a record
# http://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecord.html
#
# Setting this option to true enables hashing the key with the md5 algorithm
# before we send it to kinesis so all the keys work within the key size limit.
# Values: true, false
# Default: false
kinesis_md5_keys=<%= node['maxwell']['kinesis']['md5_keys'] %>
<% end %>

<% if node['maxwell']['producer'] == 'pubsub' %>
######### GCP pub/sub #####################
pubsub_project_id=<%= node['maxwell']['pubsub']['pubsub_project_id'] %>
pubsub_topic=<%= node['maxwell']['pubsub']['pubsub_topic'] %>
ddl_pubsub_topic=<%= node['maxwell']['pubsub']['ddl_pubsub_topic'] %>
<% end %>

<% if node['maxwell']['producer'] == 'rabbitmq' %>
######### rabbitmq ###################
rabbitmq_host=<%= node['maxwell']['rabbitmq']['host'] %>
rabbitmq_user=<%= node['maxwell']['rabbitmq']['user'] %>
rabbitmq_pass=<%= node['maxwell']['rabbitmq']['pass'] %>
rabbitmq_virtual_host=<%= node['maxwell']['rabbitmq']['virtual_host'] %>
rabbitmq_exchange=<%= node['maxwell']['rabbitmq']['exchange'] %>
rabbitmq_exchange_type=<%= node['maxwell']['rabbitmq']['exchange_type'] %>
rabbitmq_exchange_durable=<%= node['maxwell']['rabbitmq']['exchange_durable'] %>
rabbitmq_exchange_autodelete=<%= node['maxwell']['rabbitmq']['exchange_autodelete'] %>
rabbitmq_routing_key_template=<%= node['maxwell']['rabbitmq']['routing_key_template'] %>
<% end %>

<% if node['maxwell']['producer'] == 'redis' %>
######### redis ######################
redis_host=<%= node['maxwell']['redis']['host'] %>
redis_port=<%= node['maxwell']['redis']['port'] %>
redis_auth=<%= node['maxwell']['redis']['auth'] %>
redis_database=<%= node['maxwell']['redis']['database'] %>
redis_pub_channel=<%= node['maxwell']['redis']['pub_channel'] %>
<% end %>

######### filtering #########

# filter rows out of Maxwell's output.  Command separated list of filter-rules, evaluated in sequence.
# A filter rule is:
#  type ":" db "." tbl [ "." col "=" col_val ]
#  type    ::= [ "include" | "exclude" | "blacklist" ]
#  db      ::= [ "/regexp/" | "string" | "`string`" | "*" ]
#  tbl     ::= [ "/regexp/" | "string" | "`string`" | "*" ]
#  col_val ::= "column_name"
#  tbl     ::= [ "/regexp/" | "string" | "`string`" | "*" ]
#
# See http://maxwells-daemon.io/filtering for more details
#

#filter= exclude: *.*, include: foo.*, include: bar.baz, include: foo.bar.col_eg = "value_to_match"

# javascript filter
# maxwell can run a bit of javascript for each row if you need very custom filtering/data munging.
# See http://maxwells-daemon.io/filtering/#javascript_filters for more details
#
#javascript=/path/to/javascript_filter_file

filter= <%= @exclude_expressions %>, <%= @include_expressions %>

######## monitoring stuff ###########

# Maxwell collects metrics via dropwizard. These can be exposed through the
# base logging mechanism (slf4j), JMX, HTTP or pushed to Datadog.
# Options: [jmx, slf4j, http, datadog]
# Supplying multiple is allowed.
metrics_type=<%= node['maxwell']['monitor']['metrics_type'] %>

# The prefix maxwell will apply to all metrics
metrics_prefix=<%= node['maxwell']['monitor']['metrics_prefix'] %>

<% if node['maxwell']['monitor']['metrics_type'] =~ /slf4j/ %>
# When metrics_type includes slf4j this is the frequency metrics are emitted to the log, in seconds
metrics_slf4j_interval=<%= node['maxwell']['monitor']['metrics_slf4j_interval'] %>
<% end %>

<% if node['maxwell']['monitor']['metrics_type'] =~ /http/ %>
# When metrics_type includes http this is the port the server will bind to.
metrics_http_port=<%= node['maxwell']['monitor']['metrics_http_port'] %>
<% end %>

<% if node['maxwell']['monitor']['metrics_type'] =~ /datadog/ %>
# ** The following are Datadog specific. **
# When metrics_type includes datadog this is the way metrics will be reported.
# Options: [udp, http]
# Supplying multiple is not allowed.
metrics_datadog_type=<%= node['maxwell']['monitor']['metrics_datadog_type'] %>

# datadog tags that should be supplied
metrics_datadog_tags=<%= node['maxwell']['monitor']['metrics_datadog_tags'] %>

# The frequency metrics are pushed to datadog, in seconds
metrics_datadog_interval=<%= node['maxwell']['monitor']['metrics_datadog_interval'] %>

# required if metrics_datadog_type = http
metrics_datadog_apikey=<%= node['maxwell']['monitor']['metrics_datadog_apikey'] %>

# required if metrics_datadog_type = udp
metrics_datadog_host=<%= node['maxwell']['monitor']['metrics_datadog_host'] %>
metrics_datadog_port=<%= node['maxwell']['monitor']['metrics_datadog_port'] %>
<% end %>

######### encryption ###############

# convert the data field to a json string and encrypt it
encrypt_data=<%= node['maxwell']['encrypt_data'] %>

<% if node['maxwell']['encrypt_data'] == 'true' %>
# convert the whole payload to a json string and encrypt it
encrypt_all=<%= node['maxwell']['encrypt_all'] %>

# specify the encryption key and secret key
encryption_key=<%= node['maxwell']['encryption_key'] %>
secret_key=<%= node['maxwell']['secret_key'] %>
<% end %>

######### misc stuff ###############

# maxwell's bootstrapping functionality has a couple of modes.
#
# In "async" mode, maxwell will output the replication stream while it
# simultaneously outputs the database to the topic.  Note that it won't
# output replication data for any tables it is currently bootstrapping -- this
# data will be buffered and output after the bootstrap is complete.
#
# In "sync" mode, maxwell stops the replication stream while it
# outputs bootstrap data.
#
# async mode keeps ops live while bootstrapping, but carries the possibility of
# data loss (due to buffering transactions).  sync mode is safer but you
# have to stop replication.
# [sync, async, none]
bootstrapper=<%= node['maxwell']['bootstrapper'] %>

# output filename when using the "file" producer
output_file=<%= node['maxwell']['output_file'] %>
