diff options
| author | Paul Buetow <paul@buetow.org> | 2021-10-05 22:39:58 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2021-10-05 22:39:58 +0300 |
| commit | 9f395a03f25941d8ed98ec43035688daa1e8877f (patch) | |
| tree | bf3a2a97012c876cced1cc03c006af1a86113a61 /cmd | |
| parent | f70622f307629a2542ea5eb128dea8c1043d3a40 (diff) | |
more on this
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/dcat/main.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd/dcat/main.go b/cmd/dcat/main.go index 9fe776b..ee851ab 100644 --- a/cmd/dcat/main.go +++ b/cmd/dcat/main.go @@ -3,9 +3,14 @@ package main import ( "context" "flag" + "fmt" "os" "sync" + "net/http" + _ "net/http" + _ "net/http/pprof" + "github.com/mimecast/dtail/internal/clients" "github.com/mimecast/dtail/internal/config" "github.com/mimecast/dtail/internal/io/dlog" @@ -19,6 +24,7 @@ import ( func main() { var args config.Args var displayVersion bool + var pprof int userName := user.Name() @@ -29,6 +35,7 @@ func main() { flag.BoolVar(&displayVersion, "version", false, "Display version") flag.IntVar(&args.ConnectionsPerCPU, "cpc", config.DefaultConnectionsPerCPU, "How many connections established per CPU core concurrently") flag.IntVar(&args.SSHPort, "port", config.DefaultSSHPort, "SSH server port") + flag.IntVar(&pprof, "pprof", -1, "Start PProf server this port") flag.StringVar(&args.ConfigFile, "cfg", "", "Config file path") flag.StringVar(&args.Discovery, "discovery", "", "Server discovery method") flag.StringVar(&args.LogDir, "logDir", "~/log", "Log dir") @@ -53,6 +60,13 @@ func main() { wg.Add(1) dlog.Start(ctx, &wg, source.Client, config.Common.LogLevel) + if pprof > -1 { + // For debugging purposes only + pprofArgs := fmt.Sprintf("0.0.0.0:%d", pprof) + go http.ListenAndServe(pprofArgs, nil) + dlog.Client.Info("Started PProf", pprofArgs) + } + client, err := clients.NewCatClient(args) if err != nil { panic(err) |
