Bug 1187296
Summary: | No way to gracefully rotate the libgfapi Samba vfs_glusterfs logfile. | |||
---|---|---|---|---|
Product: | [Community] GlusterFS | Reporter: | Jeff Byers <jbyers> | |
Component: | libgfapi | Assignee: | Shyamsundar <srangana> | |
Status: | CLOSED DEFERRED | QA Contact: | Sudhir D <sdharane> | |
Severity: | medium | Docs Contact: | ||
Priority: | medium | |||
Version: | mainline | CC: | atumball, bugs, jbyers, ndevos, srangana | |
Target Milestone: | --- | Keywords: | Triaged | |
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | Doc Type: | Bug Fix | ||
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1369452 1369453 (view as bug list) | Environment: | ||
Last Closed: | 2019-05-14 09:27:59 UTC | Type: | Bug | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: | ||||
Bug Depends On: | ||||
Bug Blocks: | 1369452, 1369453 |
Description
Jeff Byers
2015-01-29 17:43:54 UTC
We have to think about providing something like an API to enable rotating the logs in a usable way. I agree that stopping/starting an application that uses libgfapi (like samba) is not acceptable. When we have defined and implemented an API for this, we need to inform the Samba community about this new functionality. Shyam, are you interested in looking into this, or shall I do that? Let me take a stab at it. Assigned to myself. Current situation: The regular gluster deamons, use SIGHUP to get notified on log rotations, so when the logrotate cron job runs, it notifies glusterfs(d), glusterd, et. al. via a HUP to close the old fd/FILE and open a new one. logrotate in the background has already renamed the file to its backup name etc. gfapi cannot override HUP as it is being used by another service and is not a deamon buy itself. As a result, there is no way currently to notify gfapi that a log rotation has been performed. Here are the options for gfapi consumers: 1) Add a logrotate entry for the log file that is configured via SAMBA (or any other service that uses gfapi) with the copytruncate flag in the rotate command. copytruncate, will let the deamon operate on the same fd/FILE whereas copy the old contents and truncate the original file, as a result we achieve rotation. @Jeff, possibly even academic, but could you try this option? If not, just remove the NEEDINFO flag against yourself. 2) Provide an API that the consumer of gfapi can call, to gracefully rotate logs, and consumer would need to handle when this API is called (say in their HUP signal handler). This requires changes (as stated by Niels) in gfapi and its consumers. (In reply to Shyamsundar from comment #3) > Current situation: > The regular gluster deamons, use SIGHUP to get notified on log rotations, so > when the logrotate cron job runs, it notifies glusterfs(d), glusterd, et. > al. via a HUP to close the old fd/FILE and open a new one. logrotate in the > background has already renamed the file to its backup name etc. > > gfapi cannot override HUP as it is being used by another service and is not > a deamon buy itself. As a result, there is no way currently to notify gfapi > that a log rotation has been performed. > > Here are the options for gfapi consumers: > > 1) Add a logrotate entry for the log file that is configured via SAMBA (or > any other service that uses gfapi) with the copytruncate flag in the rotate > command. > > copytruncate, will let the deamon operate on the same fd/FILE whereas copy > the old contents and truncate the original file, as a result we achieve > rotation. > > @Jeff, possibly even academic, but could you try this option? If not, just > remove the NEEDINFO flag against yourself. > > 2) Provide an API that the consumer of gfapi can call, to gracefully rotate > logs, and consumer would need to handle when this API is called (say in > their HUP signal handler). > > This requires changes (as stated by Niels) in gfapi and its consumers. I did not use logrotate, but performed the test manually by hand. The logrodate copytruncate option (or the functional equivalent) should work fine. This implies that there is no logfile offset knowledge, or seeking within the logfile, other than to the EOF, which seems likely. Thanks. |