Revolyssup opened a new issue, #9443:
URL: https://github.com/apache/apisix/issues/9443

   ### Current Behavior
   
   http-logger fails to perform a successful POST on the HTTP log server and 
instead returns a 400 error. 
   
   ### Expected Behavior
   
   http-logger should successfully POST the logs on the HTTP server.
   
   ### Error Logs
   
   
   ```
   2023/05/09 10:39:19 [error] 32037#0: *57331 [lua] batch-processor.lua:95: 
Batch Processor[http logger] failed to process entries: server returned status 
code[400] host[localhost] port[3000] body[], context: ngx.timer, client: 
127.0.0.1, server: 0.0.0.0:9080
   2023/05/09 10:39:19 [error] 32037#0: *57331 [lua] batch-processor.lua:104: 
Batch Processor[http logger] exceeded the max_retry_count[1] dropping the 
entries, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   ```
   
   
   ### Steps to Reproduce
   
   1. Run APISIX
   2. Run vector server (either locally or in a container with exposed port) 
with the following configuration
   ```
   [sources.log-from-http]
   type = "http_server"
   address = "0.0.0.0:3000"
   [sinks.log-2-console]
   inputs = ["log-from-http"]
   type = "console"
   encoding.codec = "json"
   ```
   3. Pass the below configurations to admin API
   
   ```
   curl http://127.0.0.1:9180/apisix/admin/plugin_metadata/http-logger \
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "log_format": {
           "host": "$host",
           "@timestamp": "$time_iso8601",
           "client_ip": "$remote_addr"
       }
   }'
   ```
   ```
   curl http://127.0.0.1:9180/apisix/admin/routes/1 \
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
         "plugins": {
               "http-logger": {
                   "uri": "http://localhost:3000";
               }
          },
         "upstream": {
              "type": "roundrobin",
              "nodes": {
                  "httpbin.org:80": 1
              }
         },
         "uri": "/"
   }'
   
   ```
   4. Send request: `curl -i http://127.0.0.1:9080`
   5. Check error logs
   
   ### Environment
   
   - APISIX version 3.3.0
   - Operating system: Linux 6.2.13-arch1-1
   - nginx version: openresty/1.21.4.1
   - LuaRocks version, for installation issues : 3.8.0
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to