Bug 1664744 - [DOCS] Looks like fluentd is keeping open deleted journal files that have been rotated
Summary: [DOCS] Looks like fluentd is keeping open deleted journal files that have bee...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Documentation
Version: 3.11.0
Hardware: All
OS: Linux
high
high
Target Milestone: ---
: 3.11.z
Assignee: Ashley Hardin
QA Contact: Anping Li
Vikram Goyal
URL:
Whiteboard:
Depends On: 1560358
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-09 14:59 UTC by Justin Pierce
Modified: 2023-10-06 18:04 UTC (History)
20 users (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
Cause: A fluentd dependency on a systemd library is not releasing file handles Consequence: The host eventually runs out of file handles Workaround (if any): Periodically recycle fluentd to force the process to release unused file handles Result:
Clone Of: 1560358
Environment:
Last Closed: 2019-04-17 19:42:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Comment 1 Rich Megginson 2019-01-09 15:13:37 UTC
The workaround is to periodically restart fluentd by labelling and unlabelling the nodes:

oc label node -l logging-infra-fluentd=true logging-infra-fluentd=false

# wait for fluentd to shutdown, then

oc label node -l logging-infra-fluentd=false logging-infra-fluentd=true

I think that should unblock Ops until we can get a better fix

Comment 4 Sam Mingo 2019-02-13 13:51:03 UTC
This issue seems like it's related to this - https://github.com/ledbettj/systemd-journal/issues/70.

Comment 5 Jeff Cantrill 2019-02-13 13:54:45 UTC
The only known work around at this time is to cycle the fluent nodes.  This [1] describes a method by which one can create a cronjob to do just that.  It does not take into account 'Ready' pods like it probably should.  Additionally, there is a balancing act of how often to check, backpressure, etc.

[1] https://github.com/openshift/origin-aggregated-logging/pull/1508

Comment 6 Jeff Cantrill 2019-03-04 14:57:06 UTC
User's will need to deploy cronjob as suggested by [1].  Created JIRA card to add into cluster-logging-operator [2].  Closing as won't fix

[1] https://github.com/openshift/origin-aggregated-logging/blob/master/docs/troubleshooting.md#fluentd-is-holding-onto-deleted-journald-files-that-have-been-rotated
[2] https://jira.coreos.com/browse/LOG-348

Comment 7 Eric Rich 2019-03-04 18:21:51 UTC
We should confirm that https://access.redhat.com/solutions/3958661 solves this issue. If done so - we should move this over to a docs bug to get fixed as a known issue in docs. 
After we QE this bug and get sign off https://access.redhat.com/solutions/3958661 can be published while we wait on docs to be included.

Comment 8 Jack Ottofaro 2019-03-11 16:27:56 UTC
I tested  https://access.redhat.com/solutions/3958661 which works as is but I did find one improvement I hoped to make. The cron job will continually delete the fluentd pod regardless of whether the fluentd process is retaining deleted journal files. In other words, it makes no difference why /var/log exceeds threshold the fluentd pod will be deleted. I had hoped to put in an lsof based check for retained journal files in the cron but since the fluentd process is ran by root it results permission errors.

I will add a note to the solution warning of this possibility along with a suggested action of either raising the threshold or finding the current source of the excessive /var/log growth.

Comment 9 Jeff Cantrill 2019-03-11 18:49:51 UTC
(In reply to Jack Ottofaro from comment #8)
> I tested  https://access.redhat.com/solutions/3958661 which works as is but
> I did find one improvement I hoped to make. The cron job will continually
> delete the fluentd pod regardless of whether the fluentd process is
> retaining deleted journal files. In other words, it makes no difference why
> /var/log exceeds threshold the fluentd pod will be deleted. I had hoped to
> put in an lsof based check for retained journal files in the cron but since
> the fluentd process is ran by root it results permission errors.

The source of this solution did this exact check but I thought I determined the OCP image does not contain 'lsof'. I would love to proven wrong.

> 
> I will add a note to the solution warning of this possibility along with a
> suggested action of either raising the threshold or finding the current
> source of the excessive /var/log growth.

Isn't the excessive growth the fact that the collector fluentd is incapable of keeping up with the log generation?  The solution is to log less which, for instance, you reduce your log level. Do you have debug level on?

Comment 10 Jack Ottofaro 2019-03-11 21:01:11 UTC
(In reply to Jeff Cantrill from comment #9)
> (In reply to Jack Ottofaro from comment #8)
> > I tested  https://access.redhat.com/solutions/3958661 which works as is but
> > I did find one improvement I hoped to make. The cron job will continually
> > delete the fluentd pod regardless of whether the fluentd process is
> > retaining deleted journal files. In other words, it makes no difference why
> > /var/log exceeds threshold the fluentd pod will be deleted. I had hoped to
> > put in an lsof based check for retained journal files in the cron but since
> > the fluentd process is ran by root it results permission errors.
> 
> The source of this solution did this exact check but I thought I determined
> the OCP image does not contain 'lsof'. I would love to proven wrong.

lsof is there but upon closer inspection my issue is I cannot get the fluentd pid.

 
> > I will add a note to the solution warning of this possibility along with a
> > suggested action of either raising the threshold or finding the current
> > source of the excessive /var/log growth.
> 
> Isn't the excessive growth the fact that the collector fluentd is incapable
> of keeping up with the log generation?  The solution is to log less which,
> for instance, you reduce your log level. Do you have debug level on?

In general I suppose you are correct about the underlying reason. For my testing, I had only configured my journal settings on one node for testing purposes and to get it to start building up deleted files. However I had a second node on which I did not do this. There's only one threshold setting. The fluentd pod on the second node will continually be restarted because the node is exceeding the threshold and restarting fluentd pod doesn't help because deleted files are not being retained. 

I think just a note that the threshold is cluster wide and therefore you need to configure the journal on each node the same.

Comment 11 Rich Megginson 2019-03-11 21:37:34 UTC
(In reply to Jack Ottofaro from comment #10)
> (In reply to Jeff Cantrill from comment #9)
> > (In reply to Jack Ottofaro from comment #8)
> > > I tested  https://access.redhat.com/solutions/3958661 which works as is but
> > > I did find one improvement I hoped to make. The cron job will continually
> > > delete the fluentd pod regardless of whether the fluentd process is
> > > retaining deleted journal files. In other words, it makes no difference why
> > > /var/log exceeds threshold the fluentd pod will be deleted. I had hoped to
> > > put in an lsof based check for retained journal files in the cron but since
> > > the fluentd process is ran by root it results permission errors.
> > 
> > The source of this solution did this exact check but I thought I determined
> > the OCP image does not contain 'lsof'. I would love to proven wrong.
> 
> lsof is there but upon closer inspection my issue is I cannot get the
> fluentd pid.

From which context are you trying to get the fluentd pid?  If you are on the node, trying to get the pid of the fluentd running in a pod on that node, see https://github.com/openshift/origin-aggregated-logging/blob/release-3.11/test/zzz-duplicate-entries.sh#L35


> 
>  
> > > I will add a note to the solution warning of this possibility along with a
> > > suggested action of either raising the threshold or finding the current
> > > source of the excessive /var/log growth.
> > 
> > Isn't the excessive growth the fact that the collector fluentd is incapable
> > of keeping up with the log generation?  The solution is to log less which,
> > for instance, you reduce your log level. Do you have debug level on?
> 
> In general I suppose you are correct about the underlying reason. For my
> testing, I had only configured my journal settings on one node for testing
> purposes and to get it to start building up deleted files. However I had a
> second node on which I did not do this. There's only one threshold setting.
> The fluentd pod on the second node will continually be restarted because the
> node is exceeding the threshold and restarting fluentd pod doesn't help
> because deleted files are not being retained. 

You might glean some ideas from https://github.com/openshift/origin-aggregated-logging/blob/release-3.11/test/zzz-duplicate-entries.sh

> 
> I think just a note that the threshold is cluster wide and therefore you
> need to configure the journal on each node the same.

Comment 12 Anping Li 2019-03-29 10:08:10 UTC
QE couldn't reproduce this issue. Is this related to special journald version? I am using systemd-219-62.el7_6.5.x86_64 and openshift3/ose-logging-fluentd/images/v3.11.88-2 (fluent-plugin-systemd (0.0.11) , systemd-journal (1.3.3) )?

Comment 13 Rich Megginson 2019-03-29 21:36:23 UTC
(In reply to Anping Li from comment #12)
> QE couldn't reproduce this issue. Is this related to special journald
> version? I am using systemd-219-62.el7_6.5.x86_64 and
> openshift3/ose-logging-fluentd/images/v3.11.88-2 (fluent-plugin-systemd
> (0.0.11) , systemd-journal (1.3.3) )?

Was QE able to reproduce the problem with a previous version of OCP or logging or systemd-journald?

Comment 20 Ashley Hardin 2019-04-15 12:33:07 UTC
Work in progress: https://github.com/openshift/openshift-docs/pull/14449

Comment 21 Anping Li 2019-04-16 01:35:43 UTC
The doc LGTM

Comment 22 Eric Rich 2019-04-16 10:11:21 UTC
Looks good.


Note You need to log in before you can comment on or make changes to this bug.