Skip to content

More support export logs #102

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

Merged
merged 18 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
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
33 changes: 33 additions & 0 deletions internal/cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,39 @@ func (exec Executor) listPGLogFiles(numLogs int) (string, string, error) {
return stdout.String(), stderr.String(), err
}

// listPGConfFiles returns the full path of Postgres conf files.
// These are the *.conf stored on the Postgres instance
func (exec Executor) listPGConfFiles() (string, string, error) {
var stdout, stderr bytes.Buffer

command := "ls -1dt pgdata/pg[0-9][0-9]/*.conf"
err := exec(nil, &stdout, &stderr, "bash", "-ceu", "--", command)

return stdout.String(), stderr.String(), err
}

// listBackrestLogFiles returns the full path of pgBackRest log files.
// These are the pgBackRest logs stored on the Postgres instance
func (exec Executor) listBackrestLogFiles() (string, string, error) {
var stdout, stderr bytes.Buffer

command := "ls -1dt pgdata/pgbackrest/log/*"
err := exec(nil, &stdout, &stderr, "bash", "-ceu", "--", command)

return stdout.String(), stderr.String(), err
}

// listBackrestRepoHostLogFiles returns the full path of pgBackRest log files.
// These are the pgBackRest logs stored on the repo host
func (exec Executor) listBackrestRepoHostLogFiles() (string, string, error) {
var stdout, stderr bytes.Buffer

command := "ls -1dt pgbackrest/*/log/*"
err := exec(nil, &stdout, &stderr, "bash", "-ceu", "--", command)

return stdout.String(), stderr.String(), err
}

// catFile takes the full path of a file and returns the contents
// of that file
func (exec Executor) catFile(filePath string) (string, string, error) {
Expand Down
Loading
Loading