Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding UDP logger plugin #1070

Merged
merged 5 commits into from
Jan 17, 2020
Merged

Adding UDP logger plugin #1070

merged 5 commits into from
Jan 17, 2020

Conversation

sshniro
Copy link
Member

@sshniro sshniro commented Jan 16, 2020

The UDP logger sends the logs to a UDP server.
Fix for #1069

lua/apisix/plugins/udp-logger.lua Outdated Show resolved Hide resolved
lua/apisix/plugins/udp-logger.lua Outdated Show resolved Hide resolved
lua/apisix/plugins/udp-logger.lua Outdated Show resolved Hide resolved
lua/apisix/plugins/udp-logger.lua Outdated Show resolved Hide resolved
lua/apisix/plugins/udp-logger.lua Outdated Show resolved Hide resolved
lua/apisix/plugins/udp-logger.lua Show resolved Hide resolved
@membphis
Copy link
Member

There are performance issues with the per-request log message mode.

It is better to put log messages in the queue first, and then send them in batches.

@moonming
Copy link
Member

There are performance issues with the per-request log message mode.

It is better to put log messages in the queue first, and then send them in batches.

Done is better then perfect. I think we can use another PR to fix performance issues.

@membphis
Copy link
Member

t/admin/plugins.t ...................... 1/? 
#   Failed test 'TEST 1: get plugins' name - response_body_like - response is expected (["limit-req","limit-count","limit-conn","key-auth","basic-auth","prometheus","node-status","jwt-auth","zipkin","ip-restriction","grpc-transcode","serverless-pre-function","serverless-post-function","openid-connect","proxy-rewrite","redirect","response-rewrite","fault-injection","udp-logger"])'
#   at /home/travis/build/apache/incubator-apisix/test-nginx/lib/Test/Nginx/Socket.pm line 1635.
#                   '["limit-req","limit-count","limit-conn","key-auth","basic-auth","prometheus","node-status","jwt-auth","zipkin","ip-restriction","grpc-transcode","serverless-pre-function","serverless-post-function","openid-connect","proxy-rewrite","redirect","response-rewrite","fault-injection","udp-logger"]
# '
#     doesn't match '(?^:\["limit-req","limit-count","limit-conn","key-auth","prometheus","node-status","jwt-auth","zipkin","ip-restriction","grpc-transcode","serverless-pre-function","serverless-post-function","openid-connect","proxy-rewrite","redirect","response-rewrite","udp-logger"\])'
t/admin/plugins.t ...................... 3/? # Looks like you failed 1 test of 3.

lua/apisix/plugins/log-util.lua Outdated Show resolved Hide resolved
lua/apisix/plugins/log-util.lua Outdated Show resolved Hide resolved
lua/apisix/plugins/udp-logger.lua Outdated Show resolved Hide resolved
lua/apisix/plugins/udp-logger.lua Outdated Show resolved Hide resolved
@sshniro
Copy link
Member Author

sshniro commented Jan 17, 2020

@membphis The following is the final log sent to the server.

{
  "upstream": "127.0.0.1:80",
  "start_time": 1579231324391,
  "client_ip": "127.0.0.1",
  "service_id": "10",
  "route_id": "5",
  "request": {
    "querystring": {
      "param1": "value"
    },
    "size": 118,
    "uri": "/?param1=value",
    "url": "http://127.0.0.1:9080/?param1=value",
    "headers": {
      "host": "127.0.0.1:9080",
      "apikey": "superSecretAPIKey",
      "accept": "*/*",
      "user-agent": "curl/7.58.0"
    },
    "method": "GET"
  },
  "response": {
    "headers": {
      "accept-ranges": "bytes",
      "content-type": "text/html",
      "date": "Fri, 17 Jan 2020 03:22:04 GMT",
      "server": "APISIX web server",
      "connection": "close",
      "last-modified": "Thu, 29 Aug 2019 23:49:13 GMT",
      "etag": "\"5d686479-289\"",
      "content-length": "649"
    },
    "status": 200,
    "size": 892
  },
  "latency": 0.99992752075195
}

should I round the number for latency?

@membphis
Copy link
Member

should I round the number for latency?

Recommended to milliseconds.

@sshniro
Copy link
Member Author

sshniro commented Jan 17, 2020

@membphis the review comments have been resolved, thanks for the pointers.

Copy link
Member

@membphis membphis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants