local rspamd_http = require "rspamd_http"
local rspamd_util = require "rspamd_util"
local rspamd_logger = require "rspamd_logger"
+local rspamd_tcp = require "rspamd_tcp"
local ucl = require "ucl"
local E = {}
local N = 'metadata_exporter'
timeout = rule.timeout or settings.timeout,
}, formatted, sendmail_cb)
end,
+ json_raw = function(task, formatted, rule)
+ local function json_raw_callback(err, code)
+ if err then
+ rspamd_logger.errx(task, 'got error %s in json_raw callback', err)
+ return maybe_defer(task, rule)
+ end
+ return true
+ end
+ rspamd_tcp.request({
+ task=task,
+ host=rule.host,
+ port=rule.port,
+ data=formatted,
+ callback=json_raw_callback,
+ read=false,
+ })
+ end,
}
local opts = rspamd_config:get_all_opt(N)
settings.rules[r.backend:upper()] = r
end
end
+ if settings.pusher_enabled.json_raw then
+ if not (settings.host and settings.port) then
+ rspamd_logger.errx(rspamd_config, 'No host and/or port is specified')
+ settings.pusher_enabled.json_raw = nil
+ else
+ local r = {}
+ r.backend = 'json_raw'
+ r.host = settings.host
+ r.port = settings.port
+ r.defer = settings.defer
+ r.selector = settings.pusher_select.json_raw
+ r.formatter = settings.pusher_format.json_raw
+ settings.rules[r.backend:upper()] = r
+ end
+ end
if not next(settings.pusher_enabled) then
rspamd_logger.errx(rspamd_config, 'No push backend enabled')
return
redis_pubsub = {
'channel',
},
+ json_raw = {
+ 'host',
+ 'port',
+ },
}
local check_element = {
selector = function(k, v)