Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(agent): Allow specifying log directory via flag or env#5915

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mafredri merged 4 commits intomainfrommafredri/feat-agent-log-dir
Jan 30, 2023

Conversation

mafredri
Copy link
Member

@mafredrimafredri commentedJan 30, 2023
edited
Loading

This PR adds support for--log-dir and$CODER_AGENT_LOG_DIR.

This is useful for storing the logs in persistent storage. For instance in Docker containers/tmp can often be mounted as tmpfs, and this may have RAM implications and does not persist. Similarly it's currently not possible to run multiple agents on the same machine because they write to the same log.

NOTE: That this PR targets another PR due to introduction of an additional log file.

@mafredrimafredri self-assigned thisJan 30, 2023
@@ -582,7 +588,7 @@ func (a *agent) runStartupScript(ctx context.Context, script string) error {
}

a.logger.Info(ctx, "running startup script", slog.F("script", script))
writer, err := a.filesystem.OpenFile(filepath.Join(a.tempDir, "coder-startup-script.log"), os.O_CREATE|os.O_RDWR, 0o600)
writer, err := a.filesystem.OpenFile(filepath.Join(a.logDir, "coder-startup-script.log"), os.O_CREATE|os.O_RDWR, 0o600)
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Suggested change
writer,err:=a.filesystem.OpenFile(filepath.Join(a.logDir,"coder-startup-script.log"),os.O_CREATE|os.O_RDWR,0o600)
writer,err:=a.filesystem.OpenFile(filepath.Join(a.logDir,"coder-startup-script.log"),os.O_CREATE|os.O_RDWR,0o600)

I'd want to rename this tocoder-agent-startup-script.log as well, for uniformity (needs docs updates and could be done in a separate PR if it sounds like a good idea).

Copy link
Member

@mtojekmtojek left a comment

Choose a reason for hiding this comment

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

👍

Base automatically changed frommafredri/feat-handle-agent-signals tomainJanuary 30, 2023 13:59
@mafredrimafredriforce-pushed themafredri/feat-agent-log-dir branch from580fda2 to284b7fdCompareJanuary 30, 2023 14:01
@mafredrimafredri merged commitf4d6afb intomainJan 30, 2023
@mafredrimafredri deleted the mafredri/feat-agent-log-dir branchJanuary 30, 2023 16:39
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJan 30, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@kylecarbskylecarbskylecarbs approved these changes

@mtojekmtojekmtojek approved these changes

Assignees

@mafredrimafredri

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@mafredri@kylecarbs@mtojek

[8]ページ先頭

©2009-2025 Movatter.jp