github.com/cockroachdb/pebble@v1.1.1-0.20240513155919-3622ade60459/tool/logs/tool.go (about) 1 // Copyright 2021 The LevelDB-Go and Pebble Authors. All rights reserved. Use 2 // of this source code is governed by a BSD-style license that can be found in 3 // the LICENSE file. 4 5 package logs 6 7 import ( 8 "time" 9 10 "github.com/spf13/cobra" 11 ) 12 13 // NewCmd returns a new cobra.Command for parsing logs. 14 func NewCmd() *cobra.Command { 15 cmd := &cobra.Command{ 16 Use: "logs", 17 Short: "Scan and summarize logs", 18 } 19 20 compactionCmd := &cobra.Command{ 21 Use: "compactions", 22 Short: "Scan and summarize compaction logs", 23 RunE: runCompactionLogs, 24 } 25 compactionCmd.Flags().Duration( 26 "window", 10*time.Minute, "time window in which to aggregate compactions") 27 compactionCmd.Flags().Duration( 28 "long-running-limit", 0, "log compactions with runtime greater than the limit") 29 30 cmd.AddCommand(compactionCmd) 31 return cmd 32 }