1、编写main.lua ,用于启动并使用该插件,此处我用的是lua-resty-kafka插件
local _M = {
}
function _M.log()
local cjson = require "cjson"
local producer = require "resty.kafka.producer"
local broker_list = {
{
host = "192.168.72.1", port = 9092 },
}
local log_json = {
}
log_json["@timestamp"]=ngx.var.time_iso8601
log_json["sa"]=ngx.var.server_addr
log_json["ra"]=ngx.var.remote_addr
log_json["hh"]=ngx.var.http_host
log_json[