forked from johnjohnsp1/capsule8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
75 lines (59 loc) · 2.43 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package config
import (
"github.com/golang/glog"
"github.com/kelseyhightower/envconfig"
)
// Global contains overridable configuration options that apply globally
var Global struct {
// RunDir is the path to the runtime state directory for Capsule8
RunDir string `split_words:"true" default:"/var/run/capsule8"`
// HTTP address and port for the pprof runtime profiling endpoint.
ProfilingAddr string `split_words:"true"`
}
// Sensor contains overridable configuration options for the sensor
var Sensor struct {
// Node name to use if not the value returned from uname(2)
NodeName string
// DockerContainerDir is the path to the directory used for docker
// container local storage areas (i.e. /var/lib/docker/containers)
DockerContainerDir string `split_words:"true" default:"/var/lib/docker/containers"`
// OciContainerDir is the path to the directory used for the
// container runtime's container state directories
// (i.e. /var/run/docker/libcontainerd)
OciContainerDir string `split_words:"true" default:"/var/run/docker/libcontainerd"`
// Subscription timeout in seconds
SubscriptionTimeout int64 `default:"5"`
// Sensor gRPC API Server listen address may be specified as any of:
// unix:/path/to/socket
// 127.0.0.1:8484
// :8484
ServerAddr string `split_words:"true" default:"unix:/var/run/capsule8/sensor.sock"`
// Names of cgroups to monitor for events. Each cgroup specified must
// exist within the perf_event cgroup hierarchy. For example, if this
// is set to "docker", the Sensor will monitor containers for events
// and ignore processes not running in Docker containers. To monitor
// the entire system, use "" or "/" as the cgroup name.
CgroupName []string `split_words:"true"`
// Ignore missing debugfs/tracefs mount (useful for automated testing)
DontMountTracing bool `split_words:"true"`
// Ignore missing perf_event cgroup filesystem mount
DontMountPerfEvent bool `split_words:"true"`
//
// Performance knobs below here
//
// The default size of ring buffers used for kernel perf_event
// monitors. The size is defined in units of pages.
RingBufferPages int `split_words:"true" default:"8"`
// The default buffer length for Go channels used internally
ChannelBufferLength int `split_words:"true" default:"1024"`
}
func init() {
err := envconfig.Process("CAPSULE8", &Global)
if err != nil {
glog.Fatal(err)
}
err = envconfig.Process("CAPSULE8_SENSOR", &Sensor)
if err != nil {
glog.Fatal(err)
}
}