ceremonyclient/pebble/tool/logs/tool.go

33 lines
815 B
Go
Raw Normal View History

2024-01-03 07:31:42 +00:00
// Copyright 2021 The LevelDB-Go and Pebble Authors. All rights reserved. Use
// of this source code is governed by a BSD-style license that can be found in
// the LICENSE file.
package logs
import (
"time"
"github.com/spf13/cobra"
)
// NewCmd returns a new cobra.Command for parsing logs.
func NewCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "logs",
Short: "Scan and summarize logs",
}
compactionCmd := &cobra.Command{
Use: "compactions",
Short: "Scan and summarize compaction logs",
RunE: runCompactionLogs,
}
compactionCmd.Flags().Duration(
"window", 10*time.Minute, "time window in which to aggregate compactions")
compactionCmd.Flags().Duration(
"long-running-limit", 0, "log compactions with runtime greater than the limit")
cmd.AddCommand(compactionCmd)
return cmd
}