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

feat(serf) optionally log Serf commands #2410

Merged
merged 2 commits into from
Apr 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
[#2430](https://github.com/Mashape/kong/pull/2430)
- Logging retries and failure information.
[#2429](https://github.com/Mashape/kong/pull/2429).
- Serf commands are now logged with a `DEBUG` log level.
[#2410](https://github.com/Mashape/kong/pull/2410)
- Plugins:
- :fireworks: **New Request termination plugin**. This plugin allows to
temporarily disable an API and return a pre-configured response status and
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