summaryrefslogtreecommitdiff
path: root/libpod/runtime.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-04-25 12:20:39 -0700
committerGitHub <noreply@github.com>2019-04-25 12:20:39 -0700
commit01e79477ca75df54836944a94eb4840c9e9f49e1 (patch)
tree8b76672f2a4e83b0c8334132dca92e3b1279ba14 /libpod/runtime.go
parente900e95f9aa6a22eeef9f78573dfb88df2f10d49 (diff)
parent7bf7c177ab3f67d5de1689842204c258fca083e4 (diff)
downloadpodman-01e79477ca75df54836944a94eb4840c9e9f49e1.tar.gz
podman-01e79477ca75df54836944a94eb4840c9e9f49e1.tar.bz2
podman-01e79477ca75df54836944a94eb4840c9e9f49e1.zip
Merge pull request #2850 from baude/eventsjournald
journald event logging
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r--libpod/runtime.go22
1 files changed, 18 insertions, 4 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 3b1c2be98..38e0e0ff6 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -2,6 +2,7 @@ package libpod
import (
"fmt"
+ "github.com/containers/libpod/libpod/events"
"io/ioutil"
"os"
"path/filepath"
@@ -105,6 +106,9 @@ type Runtime struct {
// storage unusable). When valid is false, the runtime cannot be used.
valid bool
lock sync.RWMutex
+
+ // mechanism to read and write even logs
+ eventer events.Eventer
}
// OCIRuntimePath contains information about an OCI runtime.
@@ -222,6 +226,8 @@ type RuntimeConfig struct {
// pods.
NumLocks uint32 `toml:"num_locks,omitempty"`
+ // EventsLogger determines where events should be logged
+ EventsLogger string `toml:"events_logger"`
// EventsLogFilePath is where the events log is stored.
EventsLogFilePath string `toml:-"events_logfile_path"`
}
@@ -252,7 +258,6 @@ func defaultRuntimeConfig() (RuntimeConfig, error) {
if err != nil {
return RuntimeConfig{}, err
}
-
return RuntimeConfig{
// Leave this empty so containers/storage will use its defaults
StorageConfig: storage.StoreOptions{},
@@ -296,6 +301,7 @@ func defaultRuntimeConfig() (RuntimeConfig, error) {
EnablePortReservation: true,
EnableLabeling: true,
NumLocks: 2048,
+ EventsLogger: "journald",
}, nil
}
@@ -755,16 +761,24 @@ func makeRuntime(runtime *Runtime) (err error) {
// Set up image runtime and store in runtime
ir := image.NewImageRuntimeFromStore(runtime.store)
- if err != nil {
- return err
- }
runtime.imageRuntime = ir
// Setting signaturepolicypath
ir.SignaturePolicyPath = runtime.config.SignaturePolicyPath
+
// Set logfile path for events
ir.EventsLogFilePath = runtime.config.EventsLogFilePath
+ // Set logger type
+ ir.EventsLogger = runtime.config.EventsLogger
+
+ // Setup the eventer
+ eventer, err := runtime.newEventer()
+ if err != nil {
+ return err
+ }
+ runtime.eventer = eventer
+ ir.Eventer = eventer
defer func() {
if err != nil && store != nil {