Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-13936 support: Collect the specific logs and Time range log for support #13325

Merged
merged 16 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/control/cmd/daos_agent/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ type collectLogCmd struct {
}

func (cmd *collectLogCmd) Execute(_ []string) error {
err := cmd.DateTimeValidate()
if err != nil {
return err
}

var LogCollection = map[int32][]string{
support.CopyAgentConfigEnum: {""},
support.CollectAgentLogEnum: {""},
Expand Down Expand Up @@ -66,6 +71,10 @@ func (cmd *collectLogCmd) Execute(_ []string) error {
params.TargetFolder = cmd.TargetFolder
params.ExtraLogsDir = cmd.ExtraLogsDir
params.Config = cmd.getSupportConf()
params.LogStartDate = cmd.LogStartDate
params.LogEndDate = cmd.LogEndDate
params.LogStartTime = cmd.LogStartTime
params.LogEndTime = cmd.LogEndTime
for logFunc, logCmdSet := range LogCollection {
for _, logCmd := range logCmdSet {
cmd.Debugf("Log Function Enum = %d -- Log Collect Cmd = %s ", logFunc, logCmd)
Expand Down
27 changes: 22 additions & 5 deletions src/control/cmd/daos_server/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,27 @@ type collectLogCmd struct {
cfgCmd
cmdutil.LogCmd
support.CollectLogSubCmd
support.LogTypeSubCmd
}

func (cmd *collectLogCmd) Execute(_ []string) error {
var LogCollection = map[int32][]string{
support.CopyServerConfigEnum: {""},
support.CollectSystemCmdEnum: support.SystemCmd,
support.CollectServerLogEnum: support.ServerLog,
support.CollectDaosServerCmdEnum: support.DaosServerCmd,
var LogCollection = map[int32][]string{}
err := cmd.DateTimeValidate()
if err != nil {
return err
}

// Only collect the specific logs Admin,Control or Engine.
// This will ignore the system information collection.
if cmd.LogType != "" {
if err := cmd.LogTypeValidate(LogCollection); err != nil {
return err
}
} else {
LogCollection[support.CopyServerConfigEnum] = []string{""}
LogCollection[support.CollectSystemCmdEnum] = support.SystemCmd
LogCollection[support.CollectDaosServerCmdEnum] = support.DaosServerCmd
LogCollection[support.CollectServerLogEnum] = support.ServerLog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be shared too? I wonder if it would be better to pass the cmd.LogType as a parameter to cmd.LogTypeValidate().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean populate this in function cmd.LogTypeValidate()?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly.

}

// Default 4 steps of log/conf collection.
Expand Down Expand Up @@ -63,6 +76,10 @@ func (cmd *collectLogCmd) Execute(_ []string) error {
params.Config = cmd.configPath()
params.TargetFolder = cmd.TargetFolder
params.ExtraLogsDir = cmd.ExtraLogsDir
params.LogStartDate = cmd.LogStartDate
params.LogEndDate = cmd.LogEndDate
params.LogStartTime = cmd.LogStartTime
params.LogEndTime = cmd.LogEndTime
for logFunc, logCmdSet := range LogCollection {
for _, logCmd := range logCmdSet {
cmd.Debugf("Log Function Enum = %d -- Log Collect Cmd = %s ", logFunc, logCmd)
Expand Down
39 changes: 29 additions & 10 deletions src/control/cmd/dmg/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type collectLogCmd struct {
cmdutil.JSONOutputCmd
support.CollectLogSubCmd
bld strings.Builder
support.LogTypeSubCmd
}

// gRPC call to initiate the rsync and copy the logs to Admin (central location).
Expand Down Expand Up @@ -93,17 +94,30 @@ func (cmd *collectLogCmd) archLogsOnServer() error {
// Execute is run when supportCmd activates.
func (cmd *collectLogCmd) Execute(_ []string) error {
// Default log collection set
var LogCollection = map[int32][]string{
support.CollectSystemCmdEnum: support.SystemCmd,
support.CollectServerLogEnum: support.ServerLog,
support.CollectDaosServerCmdEnum: support.DaosServerCmd,
support.CopyServerConfigEnum: {""},
var LogCollection = map[int32][]string{}
var DmgInfoCollection = map[int32][]string{}

err := cmd.DateTimeValidate()
if err != nil {
return err
}

// dmg command info collection set
var DmgInfoCollection = map[int32][]string{
support.CollectDmgCmdEnum: support.DmgCmd,
support.CollectDmgDiskInfoEnum: {""},
// Only collect the specific logs Admin,Control or Engine.
// This will ignore the system information collection.
if cmd.LogType != "" {
if err := cmd.LogTypeValidate(LogCollection); err != nil {
return err
}
} else {
// Default collect everything from servers
LogCollection[support.CollectSystemCmdEnum] = support.SystemCmd
LogCollection[support.CollectDaosServerCmdEnum] = support.DaosServerCmd
LogCollection[support.CopyServerConfigEnum] = []string{""}
LogCollection[support.CollectServerLogEnum] = support.ServerLog

// dmg command info collection set
DmgInfoCollection[support.CollectDmgCmdEnum] = support.DmgCmd
DmgInfoCollection[support.CollectDmgDiskInfoEnum] = []string{""}
}

// set of support collection steps to show in progress bar
Expand Down Expand Up @@ -142,7 +156,7 @@ func (cmd *collectLogCmd) Execute(_ []string) error {
params.TargetFolder = cmd.TargetFolder
params.LogCmd = "dmg system query"

err := support.CollectSupportLog(cmd.Logger, params)
err = support.CollectSupportLog(cmd.Logger, params)

if err != nil {
return err
Expand All @@ -158,6 +172,11 @@ func (cmd *collectLogCmd) Execute(_ []string) error {
ExtraLogsDir: cmd.ExtraLogsDir,
LogFunction: logFunc,
LogCmd: logCmd,
LogStartDate: cmd.LogStartDate,
LogEndDate: cmd.LogEndDate,
LogStartTime: cmd.LogStartTime,
LogEndTime: cmd.LogEndTime,
Stop: cmd.Stop,
}
req.SetHostList(cmd.hostlist)

Expand Down
68 changes: 59 additions & 9 deletions src/control/common/proto/ctl/support.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/control/lib/control/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ type (
JsonOutput bool
LogFunction int32
LogCmd string
LogStartDate string
LogEndDate string
LogStartTime string
LogEndTime string
Stop bool
}

// CollectLogResp contains the results of a collect-log
Expand All @@ -46,6 +51,11 @@ func CollectLog(ctx context.Context, rpcClient UnaryInvoker, req *CollectLogReq)
JsonOutput: req.JsonOutput,
LogFunction: req.LogFunction,
LogCmd: req.LogCmd,
LogStartDate: req.LogStartDate,
LogEndDate: req.LogEndDate,
LogStartTime: req.LogStartTime,
LogEndTime: req.LogEndTime,
Stop: req.Stop,
})
})

Expand Down
76 changes: 76 additions & 0 deletions src/control/lib/support/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# support collect-log command

Support collect-log command will collect the logs on the servers or individual clients
for debugging purpose.This options is available for `daos_server`, `dmg` and `daos_agent` binaries.
It will collect the specific logs, config and other DAOS related metrics and system information.

`dmg support collect-log` is the single command, which will initiate the log collection
over gRPC,collect and copy the logs on each servers.Logs will be Rsync to the admin node.

`daos_server support collect-log` command will collect the information on that particular DAOS server.It will not collect the `dmg` command information as `dmg` command needs to be run from the admin node.

`daos_agent support collect-log` will collect the information on the client and collect the
DAOS client side log with other system related information.

## List of items collected as part of `dmg support collect-log`

* dmg network,storage and system command output
* daos server config
* helper_log_file mention in daos server config
* control_log_file mention in daos server config
* engines log_file mention in daos server config
* daos metrics for all the engines
* daos_server dump-topology, version output
* system information

## List of items collected as part of `daos_server support collect-log`

* daos server config
* helper_log_file mention in daos server config
* control_log_file mention in daos server config
* engines log_file mention in daos server config
* daos metrics for all the engines
* daos_server dump-topology, version output
* system information

## List of items collected as part of `daos_agent support collect-log`

* daos agent config
* log_file mention in daos agent config
* daos client log if it's set `D_LOG_FILE`
* daos_agent dump-topology, net-scan, version output
* system information

# support collect-log command options

support collect-log help describe the use of each options.

```
# dmg support collect-log --help
Usage:
dmg [OPTIONS] support collect-log [collect-log-OPTIONS]

Application Options:
--allow-proxy Allow proxy configuration via environment
-i, --insecure Have dmg attempt to connect without certificates
-d, --debug Enable debug output
--log-file= Log command output to the specified file
-j, --json Enable JSON output
-J, --json-logging Enable JSON-formatted log output
-o, --config-path= Client config file path

Help Options:
-h, --help Show this help message

[collect-log command options]
-l, --host-list= A comma separated list of addresses <ipv4addr/hostname> to connect to
-s, --stop-on-error Stop the collect-log command on very first error
-t, --target-folder= Target Folder location where log will be copied
-z, --archive Archive the log/config files
-c, --extra-logs-dir= Collect the Logs from given directory
-D, --start-date= Specify the start date, the day from log will be collected, Format: MM-DD
-F, --end-date= Specify the end date, the day till the log will be collected, Format: MM-DD
-S, --log-start-time= Specify the log collection start time, Format: HH:MM:SS
-E, --log-end-time= Specify the log collection end time, Format: HH:MM:SS
-e, --log-type= collect specific logs only admin,control,server and ignore everything else
```
Loading