Line data Source code
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 1 : func NewCmd() *cobra.Command { 15 1 : cmd := &cobra.Command{ 16 1 : Use: "logs", 17 1 : Short: "Scan and summarize logs", 18 1 : } 19 1 : 20 1 : compactionCmd := &cobra.Command{ 21 1 : Use: "compactions", 22 1 : Short: "Scan and summarize compaction logs", 23 1 : RunE: runCompactionLogs, 24 1 : } 25 1 : compactionCmd.Flags().Duration( 26 1 : "window", 10*time.Minute, "time window in which to aggregate compactions") 27 1 : compactionCmd.Flags().Duration( 28 1 : "long-running-limit", 0, "log compactions with runtime greater than the limit") 29 1 : 30 1 : cmd.AddCommand(compactionCmd) 31 1 : return cmd 32 1 : }