diff --git a/main.go b/main.go index 5cf295a..b375e41 100644 --- a/main.go +++ b/main.go @@ -62,12 +62,6 @@ func main() { opt.kubeconfig = os.Getenv("KUBECONFIG") } - if opt.directory == "" { - opt.directory = fmt.Sprintf("loks-%s", time.Now().Format("2006.01.02T15.04.05")) - } - - log.WithField("directory", opt.directory).Info("Storing logs on disk") - if opt.labels != "" { if _, err := labels.Parse(opt.labels); err != nil { log.Fatalf("Invalid label selector: %v", err) @@ -85,6 +79,12 @@ func main() { log.Fatal("At least a namespace or a resource name pattern must be given.") } + if opt.directory == "" { + opt.directory = fmt.Sprintf("loks-%s", time.Now().Format("2006.01.02T15.04.05")) + } + + log.WithField("directory", opt.directory).Info("Storing logs on disk.") + c, err := collector.NewDiskCollector(opt.directory, opt.flatFiles) if err != nil { log.Fatalf("Failed to create log collector: %v", err) @@ -93,7 +93,7 @@ func main() { // ////////////////////////////////////// // setup kubernetes client - log.Debug("Creating Kubernetes clientset...") + log.Debug("Creating Kubernetes clientset…") config, err := clientcmd.BuildConfigFromFlags("", opt.kubeconfig) if err != nil { @@ -118,7 +118,7 @@ func main() { Resource: "pods", }) - log.Debug("Starting to watch pods...") + log.Debug("Starting to watch pods…") wi, err := resourceInterface.Watch(rootCtx, metav1.ListOptions{ LabelSelector: opt.labels, diff --git a/pkg/watcher/watcher.go b/pkg/watcher/watcher.go index 6cdc761..c1608d5 100644 --- a/pkg/watcher/watcher.go +++ b/pkg/watcher/watcher.go @@ -106,7 +106,7 @@ func (w *Watcher) startLogCollectors(ctx context.Context, pod *corev1.Pod) { } func (w *Watcher) collectLogs(ctx context.Context, log logrus.FieldLogger, pod *corev1.Pod, containerName string, restartCount int) { - log.Info("Starting to collect logs.") + log.Info("Starting to collect logs…") request := w.clientset.CoreV1().Pods(pod.Namespace).GetLogs(pod.Name, &corev1.PodLogOptions{ Container: containerName,