This repository has been archived by the owner on Jan 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logging_live_reload.go
58 lines (48 loc) · 1.29 KB
/
logging_live_reload.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
package runs
import (
. "github.com/saschagrunert/crio-demos/pkg/demo"
"github.com/urfave/cli"
)
func Logging(ctx *cli.Context) error {
EnsureInfoLogLevel()
d := New(
"Logging and configuration reload",
"This demo shows how to configure CRI-O logging and",
"reload the configuration during runtime",
)
d.Step(S(
"The basic configuration file of CRI-O is available in",
"/etc/crio/crio.conf",
), S(
"head -11 /etc/crio/crio.conf",
))
d.Step(S(
"For example, the log level can be changed there too",
), S(
"grep -B3 log_level /etc/crio/crio.conf",
))
d.Step(S(
"So we can set the `log_level` to a higher verbosity",
), S(
`sudo sed -i -E 's/(log_level = )(.*)/\1"debug"/' /etc/crio/crio.conf &&`,
"grep -B3 log_level /etc/crio/crio.conf",
))
d.Step(S(
"To reload CRI-O, we have to send a SIGHUP (hangup) to the process.",
"This can be done via `systemctl reload` for your convenience.",
), S(
"sudo systemctl reload crio",
))
d.Step(S(
"The logs indicate that the configuration has been reloaded correctly",
), S(
"sudo journalctl -u crio --since '30 seconds ago' |",
"grep -A3 reloading",
))
d.Step(S(
"CRI-O now logs every request and response in debug mode",
), S(
`sudo journalctl -u crio --no-pager -n 5 | cut -c-130`,
))
return d.Run(ctx)
}