diff --git a/README.md b/README.md index 0323cde10..e40d7db80 100644 --- a/README.md +++ b/README.md @@ -125,8 +125,6 @@ $ cp snapteld /usr/local/sbin $ cp snaptel /usr/local/bin ``` -If you installed snap-telemetry package, please make sure `/usr/local/bin:/usr/local/sbin` is part of your $PATH and has higher priority than `/usr/bin:/usr/sbin`, or invoke the snap-telemetry snapteld/snaptel binary using fully qualified path. - NOTE: snap-telemetry packages prior to 0.19.0 installed `/usr/local/bin/{snapctl|snapd}` and these binaries have been renamed to `snaptel` and `snapteld`. snap-telemetry packages prior to 0.18.0 symlinked `/usr/bin/{snapctl|snapd}` to `/opt/snap/bin/{snapctl|snapd}` and may cause conflicts with [Ubuntu's `snapteld` package](http://packages.ubuntu.com/xenial-updates/snapd). Ubuntu 16.04.1 [snapteld package version 2.13+](https://launchpad.net/ubuntu/+source/snapd) installs snapd/snapctl binary in /usr/bin. These executables are not related to snap-telemetry. Running `snapctl` from snapd package will result in the following error message: ``` @@ -155,7 +153,7 @@ $ systemctl start snap-telemetry If you installed Snap from binary, you can start Snap daemon via the command: ``` $ sudo mkdir -p /var/log/snap -$ sudo snapteld --plugin-trust 0 --log-level 1 -o /var/log/snap & +$ sudo snapteld --plugin-trust 0 --log-level 1 --log-path /var/log/snap & ``` To view the service logs: diff --git a/snapteld.go b/snapteld.go index d93f58e0b..a4733389c 100644 --- a/snapteld.go +++ b/snapteld.go @@ -170,6 +170,7 @@ const ( tribe.CONFIG_CONSTRAINTS + `}` + `}` + logModule = "snapteld" ) type coreModule interface { @@ -389,7 +390,7 @@ func action(ctx *cli.Context) error { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, }).Fatal("need keyring file when trust is on (--keyring-file or -k)") } for _, k := range keyrings { @@ -398,7 +399,7 @@ func action(ctx *cli.Context) error { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, "error": err.Error(), "keyringPath": keyringPath, }).Fatal("Unable to determine absolute path to keyring file") @@ -408,7 +409,7 @@ func action(ctx *cli.Context) error { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, "error": err.Error(), "keyringPath": keyringPath, }).Fatal("bad keyring file") @@ -420,7 +421,7 @@ func action(ctx *cli.Context) error { log.WithFields( log.Fields{ "_block": "main", - "_module": "snapteld", + "_module": logModule, "error": err.Error(), "keyringPath": keyringPath, }).Fatal(err) @@ -438,7 +439,7 @@ func action(ctx *cli.Context) error { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, "error": err.Error(), "keyringPath": keyringPath, }).Warning("unable to open keyring file. not adding to keyring path") @@ -455,7 +456,7 @@ func action(ctx *cli.Context) error { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, "error": err.Error(), "keyringPath": keyringPath, }).Fatal("unable to open keyring file.") @@ -470,7 +471,7 @@ func action(ctx *cli.Context) error { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, }).Info("snapteld started", ` ss ss odyssyhhyo oyhysshhoyo @@ -863,14 +864,14 @@ func setMaxProcs(maxProcs int) { log.WithFields( log.Fields{ "_block": "main", - "_module": "snapteld", + "_module": logModule, "maxprocs": maxProcs, }).Error("Trying to set GOMAXPROCS to an invalid value") _maxProcs = 1 log.WithFields( log.Fields{ "_block": "main", - "_module": "snapteld", + "_module": logModule, "maxprocs": _maxProcs, }).Warning("Setting GOMAXPROCS to 1") _maxProcs = 1 @@ -880,14 +881,14 @@ func setMaxProcs(maxProcs int) { log.WithFields( log.Fields{ "_block": "main", - "_module": "snapteld", + "_module": logModule, "maxprocs": maxProcs, }).Error("Trying to set GOMAXPROCS larger than number of CPUs available on system") _maxProcs = numProcs log.WithFields( log.Fields{ "_block": "main", - "_module": "snapteld", + "_module": logModule, "maxprocs": _maxProcs, }).Warning("Setting GOMAXPROCS to number of CPUs on host") } @@ -900,7 +901,7 @@ func setMaxProcs(maxProcs int) { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, "given maxprocs": _maxProcs, "real maxprocs": actualNumProcs, }).Warning("not using given maxprocs") @@ -970,7 +971,7 @@ func startModule(m coreModule) error { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, "snap-module": m.Name(), }).Info("module started") } @@ -981,7 +982,7 @@ func printErrorAndExit(name string, err error) { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, "error": err.Error(), "snap-module": name, }).Fatal("error starting module") @@ -997,14 +998,14 @@ func startInterruptHandling(modules ...coreModule) { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, }).Info("shutting down modules") for _, m := range modules { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, "snap-module": m.Name(), }).Info("stopping module") m.Stop() @@ -1014,7 +1015,7 @@ func startInterruptHandling(modules ...coreModule) { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, "signal": sig.String(), }).Info("restarting app") // and restart the app (with the current configuration) @@ -1026,7 +1027,7 @@ func startInterruptHandling(modules ...coreModule) { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, "signal": sig.String(), }).Info("exiting on signal") os.Exit(0) @@ -1056,7 +1057,7 @@ func validateLevelSettings(logLevel, pluginTrust int) { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, "level": logLevel, }).Fatal("log level was invalid (needs: 1-5)") } @@ -1064,7 +1065,7 @@ func validateLevelSettings(logLevel, pluginTrust int) { log.WithFields( log.Fields{ "block": "main", - "_module": "snapteld", + "_module": logModule, "level": pluginTrust, }).Fatal("Plugin trust was invalid (needs: 0-2)") }