Skip to content

Commit

Permalink
feat(serf) optionally log Serf commands
Browse files Browse the repository at this point in the history
  • Loading branch information
subnetmarco committed Apr 18, 2017
1 parent 1bfff0f commit c64a5e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
which contains the properties of the authenticated Consumer
(`id`, `custom_id`, and `username`), if any.
[#2367](https://github.com/Mashape/kong/pull/2367)
- Serf commands are now logged with a `DEBUG` log level.
[#2410](https://github.com/Mashape/kong/pull/2410)

### Fixed

Expand Down
4 changes: 4 additions & 0 deletions kong/serf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ local pl_file = require "pl.file"
local cjson = require "cjson.safe"
local log = require "kong.cmd.utils.log"

local ngx_log = ngx.log
local DEBUG = ngx.DEBUG

local Serf = {}
Serf.__index = Serf

Expand Down Expand Up @@ -35,6 +38,7 @@ function Serf:invoke_signal(signal, args, no_rpc, full_error)
end
local rpc = no_rpc and "" or "-rpc-addr="..self.config.cluster_listen_rpc
local cmd = string.format("%s %s %s %s", self.config.serf_path, signal, rpc, tostring(args))
ngx_log(DEBUG, "[serf] running command: ", cmd)
local ok, code, stdout, stderr = pl_utils.executeex(cmd)
if not ok or code ~= 0 then
local err = stderr
Expand Down

0 comments on commit c64a5e2

Please sign in to comment.