summaryrefslogtreecommitdiff
path: root/pkg/api/handlers
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-06-22 15:05:22 -0400
committerMatthew Heon <mheon@redhat.com>2020-06-24 13:09:34 -0400
commit18300573f98883a4d6af09afe49a1e789e3a8f54 (patch)
treed8a3062f606742422a7a124ac75abbe22fee3439 /pkg/api/handlers
parentb61e429f199ca0f164054a9d758e60f94aa4d81e (diff)
downloadpodman-18300573f98883a4d6af09afe49a1e789e3a8f54.tar.gz
podman-18300573f98883a4d6af09afe49a1e789e3a8f54.tar.bz2
podman-18300573f98883a4d6af09afe49a1e789e3a8f54.zip
Set syslog for exit commands on log-level=debug
We have a flag, --syslog, for telling logrus to log to syslog as well as to the terminal. Previously, this flag also set the exit command for containers to use `--syslog` (otherwise all output from exit commands is lost). I attempted to replicate this with Podman v2.0, but quickly ran into circular import hell (the flag is defined in cmd/podman, I needed it in cmd/podman/containers, cmd/podman imports cmd/podman/containers already, etc). Instead, let's just set the syslog flag automatically on `--log-level=debug` so we log exit commands automatically when debug-level logs are requested. This is consistent with Conmon and seems to make sense. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r--pkg/api/handlers/compat/exec.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/api/handlers/compat/exec.go b/pkg/api/handlers/compat/exec.go
index 8f7016903..dae76c061 100644
--- a/pkg/api/handlers/compat/exec.go
+++ b/pkg/api/handlers/compat/exec.go
@@ -62,7 +62,8 @@ func ExecCreateHandler(w http.ResponseWriter, r *http.Request) {
utils.InternalServerError(w, err)
return
}
- exitCommandArgs, err := generate.CreateExitCommandArgs(storageConfig, runtimeConfig, false, true, true)
+ // Automatically log to syslog if the server has log-level=debug set
+ exitCommandArgs, err := generate.CreateExitCommandArgs(storageConfig, runtimeConfig, logrus.IsLevelEnabled(logrus.DebugLevel), true, true)
if err != nil {
utils.InternalServerError(w, err)
return