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

Save log file on USR1 signal #2136

Closed
qwerty287 opened this issue Aug 7, 2023 · 2 comments · Fixed by #2151
Closed

Save log file on USR1 signal #2136

qwerty287 opened this issue Aug 7, 2023 · 2 comments · Fixed by #2151
Labels
enhancement improve existing features
Milestone

Comments

@qwerty287
Copy link
Contributor

qwerty287 commented Aug 7, 2023

This is an exciting feature.

If you send a USR1 signal to woodpecker, will it "release" the file so the host can logrotate it?

Originally posted by @lonix1 in #2115 (comment)

If you send a USR1 signal to woodpecker, will it "release" the file so the host can logrotate it?

not jet that's a followup ... I need to write a wrapper for the os.FileOpen that can do so ... so that's a followup

Originally posted by @6543 in #2115 (comment)

I just created this mentioned wrapper as lib here: https://github.com/6543/logfile-open ...
... so once merged I can create a followup, that can be tested seperate

Originally posted by @6543 in #2115 (comment)

@qwerty287 qwerty287 changed the title Save file on USR1 signal Save log file on USR1 signal Aug 7, 2023
@qwerty287 qwerty287 added the enhancement improve existing features label Aug 7, 2023
@lonix1
Copy link
Contributor

lonix1 commented Aug 8, 2023

It's not really about saving the file on receiving the signal - actually the idea when receiving the SIGUSR1 signal, is to release (/close) and recreate the log file.

Once the host does something with that file (e.g. logrotate it) the woodpecker process must let go of the file handle (i.e. close file), else it will continue writing to the same file. So it should close the file then reopen it with the same name.

@6543
Copy link
Member

6543 commented Aug 8, 2023

-> #2151

qwerty287 pushed a commit that referenced this issue Aug 8, 2023
@qwerty287 qwerty287 added this to the 1.1.0 milestone Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improve existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants