# this would be the command
# logger '@cee:{"transfer_from_guid":"1111","item_type":30404,"quantity":840,"auth_code":"0000","metric_basename":"ledger","es-service":"ledger","logged_at":1372805031}'


module(load="imuxsock")
module(load="mmjsonparse")
module(load="omelasticsearch")

$template elasticsearchSchema,"%$!all-json%"

action(type="mmjsonparse")
if $parsesuccess == "OK" then {
  if $!es-service != "" then {
    $template elasticsearchIndex,"%$!es-service%-%timereported:1:10:date-rfc3339%"
    action(type="omelasticsearch"
      template="elasticsearchSchema"
      searchIndex="elasticsearchIndex"
      dynSearchIndex="on"
      server="localhost"
      serverport="9200"
      errorFile="/var/log/rsyslog-elasticsearch.log"
      bulkmode="on"
      queue.dequeuebatchsize="200"
      queue.type="linkedlist"
      queue.filename="dbq"
      queue.highwatermark="500000"
      queue.lowwatermark="400000"
      queue.discardmark="5000000"
      queue.timeoutenqueue="0"
      queue.maxdiskspace="5g"
      queue.size="2000000"
      queue.saveonshutdown="on"
      action.resumeretrycount="-1"
    )
  }
}
