Unverified Commit c8a3a6ff authored by Christian Kotzbauer's avatar Christian Kotzbauer Committed by GitHub
Browse files

Merge pull request #455 from span/jsonlogging

Support json logformatter
parents c196d4e9 b108aa4d
......@@ -115,6 +115,7 @@ Flags:
--slack-username string slack username for reboot notfications (default "kured")
--start-time string schedule reboot only after this time of day (default "0:00")
--time-zone string use this timezone for schedule inputs (default "UTC")
--log-format string log format specified as text or json, defaults to "text"
```
### Reboot Sentinel File & Period
......
......@@ -64,6 +64,7 @@ var (
messageTemplateReboot string
podSelectors []string
rebootCommand string
logFormat string
rebootDays []string
rebootStart string
......@@ -164,6 +165,9 @@ func main() {
rootCmd.PersistentFlags().BoolVar(&annotateNodes, "annotate-nodes", false,
"if set, the annotations 'weave.works/kured-reboot-in-progress' and 'weave.works/kured-most-recent-reboot-needed' will be given to nodes undergoing kured reboots")
rootCmd.PersistentFlags().StringVar(&logFormat, "log-format", "text",
"use text or json log format")
if err := rootCmd.Execute(); err != nil {
log.Fatal(err)
}
......@@ -623,6 +627,10 @@ func parseRebootCommand(rebootCommand string) []string {
}
func root(cmd *cobra.Command, args []string) {
if logFormat == "json" {
log.SetFormatter(&log.JSONFormatter{})
}
log.Infof("Kubernetes Reboot Daemon: %s", version)
nodeID := os.Getenv("KURED_NODE_ID")
......
......@@ -75,3 +75,4 @@ spec:
# - --time-zone=UTC
# - --annotate-nodes=false
# - --lock-release-delay=30m
# - --log-format=text
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment