0

I have an apache/apisix stack running on docker where I want to create a tcp-logger plugin to send log messages to graylog, which I'm doing through the api-six dashboard. Following is the gelf which I can successfully run from my local terminal:

echo -e '{"version":"1.1",  "_X-OVH-TOKEN":"graylog_token", "host": "example.org", "short_message": "Test message 618", "full_message": "Test message 618 long", "timestamp": 1385053862.3072, "level": 1, "_user_id": 9001, "_some_info": "foo", "some_metric_num": 42.0 }\0' | \
openssl s_client -quiet -no_ign_eof -connect gr-host.com:12202

My tcp-logger plugin config is the following:

{
  "_meta": {
    "disable": false
  },
  "host": "gr-host.com",
  "include_req_body": true,
  "include_resp_body": true,
  "json_format": true,
  "log_format": {
    "@timestamp": "$time_iso8601",
    "_X-OVH-TOKEN": "graylog_token",
    "client_ip": "$remote_addr",
    "host": "$host"
  },
  "port": 12202,
  "tls": false
}

I don't seem to get any errors, but the logs don't get sent to graylog. If I were to use an http-logger plugin, I get a 'port closed' error, but I'm wondering whether http won't work at all in this case.

I also tried connecting to graylog from inside the apisix container (curl -v telnet://gr-host.com:12202) and the connection works too.

I'm not sure if I'm doing anything wrong, or if there's noway to parse the gelf into a proper tcp/http plugin. Help would be much appreciated.

Jays
  • 91
  • 7

0 Answers0