You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "Sn0rt (via GitHub)" <gi...@apache.org> on 2023/05/06 08:32:28 UTC

[GitHub] [apisix] Sn0rt commented on issue #9419: bug: syslog plugin looks doesn’t work

Sn0rt commented on issue #9419:
URL: https://github.com/apache/apisix/issues/9419#issuecomment-1537089949

   it looks encoding error
   
   ```lua
   local function send_syslog_data(conf, log_message, api_ctx)
       local err_msg
       local res = true
   
       core.log.info("sending a batch logs to ", conf.host, ":", conf.port)
   
       -- fetch it from lrucache
       local logger, err = core.lrucache.plugin_ctx(
           lrucache, api_ctx, nil, logger_socket.new, logger_socket, {
               host = conf.host,
               port = conf.port,
               flush_limit = conf.flush_limit,
               drop_limit = conf.drop_limit,
               timeout = conf.timeout,
               sock_type = conf.sock_type,
               pool_size = conf.pool_size,
               tls = conf.tls,
           }
       )
   
       if not logger then
           res = false
           err_msg = "failed when initiating the sys logger processor".. err
       end
   
       -- reuse the logger object
       local ok, err = logger:log(core.json.encode(log_message)) // <--------- here, no syslog format
       if not ok then
           res = false
           err_msg = "failed to log message" .. err
       end
   
       return res, err_msg
   end
   
   
   ```
   
   <img width="735" alt="1" src="https://user-images.githubusercontent.com/2706161/236612996-89fed03d-0672-4560-93e4-aa200b915e93.png">
   
   <img width="781" alt="2" src="https://user-images.githubusercontent.com/2706161/236613001-d45c8721-93a6-46eb-a1c2-0b390f219279.png">
   
   https://stackify.com/syslog-101/


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org