Bug 1020790

Summary: [RFE] - add options to rhevm-log-collector to limit size of collected logs
Product: Red Hat Enterprise Virtualization Manager Reporter: David Jaša <djasa>
Component: ovirt-log-collectorAssignee: Douglas Schilling Landgraf <dougsland>
Status: CLOSED WONTFIX QA Contact: Pavel Stehlik <pstehlik>
Severity: low Docs Contact:
Priority: medium    
Version: 3.3.0CC: apinnick, byount, dfediuck, dougsland, lsvaty, pdwyer, rbalakri, rbarry, Rhev-m-bugs, sbonazzo, srevivo, trichard, ylavi
Target Milestone: ---Keywords: FutureFeature, Reopened
Target Release: ---Flags: sherold: Triaged+
dnecpal: testing_plan_complete-
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
ovirt-log-collector can now limit the maximum size of logs collected in order to capture only relevant logs. Logs may be extremely large in environments with many hosts or a large number of exceptions, so ovirt-log-collector can now limit the size of the collected logs, defaulting to the last day only.
Story Points: ---
Clone Of:
: 1304394 (view as bug list) Environment:
Last Closed: 2018-06-12 11:59:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 971853, 1509113    

Description David Jaša 2013-10-18 09:33:45 UTC
Description of problem:
sometimes it makes sense to limit the time range for rhev-m logs so that large amounts of irrelevant info are omitted from sosreport archive.

Version-Release number of selected component (if applicable):
rhevm-log-collector-3.3.1-1.el6ev.noarch

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 6 Itamar Heim 2014-09-09 15:44:41 UTC
we'll cover this via bug 971853 - sos will add "last log" and "all logs" at this point, and we are dependent on sos for this.

*** This bug has been marked as a duplicate of bug 971853 ***

Comment 7 Yaniv Lavi 2016-02-21 12:01:23 UTC
Please see https://bugzilla.redhat.com/show_bug.cgi?id=1304394#c4 for details.
We will provide option to collect based on size.

Comment 8 Yaniv Kaul 2016-03-30 06:32:12 UTC
Sandro, do you feel a simple 'collect only last logs per each component' is a good enough solution for this one? Do not collect rolled-over logs, for example? 
I think for 4.0 it's fairly simple to implement and should be good enough. Thoughts?

Comment 9 Sandro Bonazzola 2016-04-28 11:38:46 UTC
(In reply to Yaniv Kaul from comment #8)
> Sandro, do you feel a simple 'collect only last logs per each component' is
> a good enough solution for this one? Do not collect rolled-over logs, for
> example? 
> I think for 4.0 it's fairly simple to implement and should be good enough.
> Thoughts?

log-collector relies on sos reports collection so if sos support "Do not collect rolled-over logs" we can use it.
As far as I can tell this option doesn't exist.
What has been suggested is to expose --log-size=LOG_SIZE   (set a limit on the size of collected logs) to be passed to underlying sos (meaning that each host will collect max LOG_SIZE logs).

We can combine it with plugin option:
 logs.log_days 1 (the number of days logs to collect) for logs handled by logs plugin.
in order to limit some of the logs to last 24 hours.

Comment 10 Yaniv Kaul 2016-05-01 07:22:12 UTC
(In reply to Sandro Bonazzola from comment #9)
> (In reply to Yaniv Kaul from comment #8)
> > Sandro, do you feel a simple 'collect only last logs per each component' is
> > a good enough solution for this one? Do not collect rolled-over logs, for
> > example? 
> > I think for 4.0 it's fairly simple to implement and should be good enough.
> > Thoughts?
> 
> log-collector relies on sos reports collection so if sos support "Do not
> collect rolled-over logs" we can use it.
> As far as I can tell this option doesn't exist.
> What has been suggested is to expose --log-size=LOG_SIZE   (set a limit on
> the size of collected logs) to be passed to underlying sos (meaning that
> each host will collect max LOG_SIZE logs).

I don't know how that works - does it mean it may end up collecting only vdsm logs, and skipping supervdsm, for example?

> 
> We can combine it with plugin option:
>  logs.log_days 1 (the number of days logs to collect) for logs handled by
> logs plugin.
> in order to limit some of the logs to last 24 hours.

This looks like the right approach to me.

Comment 13 Lukas Svaty 2018-01-26 15:00:40 UTC
Verifying based Doc text as other info were not posted to this bug:

tested on: ovirt-log-collector-4.2.0-1.el7ev.noarch

"The ovirt-log-collector can now limit the maximum size of logs collected in order to capture relevant logs only. The size of the logs may be extremely large in environments with large numbers of hosts or a large number of exceptions, so ovirt-log-collector can now arbitrarily limit the size of logs collected, defaulting to the last day only."

"defaulting to the last day only.":
- Checking host logs, /var/log/messages contains more than 1 day of logs
- Checking engine logs, /var/log/ovirt-engine/engine.log contains more than 1 day of logs

Trying to see param for it:
# ovirt-log-collector --help | grep size
  --log-size=SIZE       maximum log size to collect on each host in MiB

Trying out the param compared to default run:
# ovirt-log-collector --log-size=1
...
log-collector-data]# du -skh /tmp/sosreport-LogCollector-20180126164815/log-collector-data/host-*
25M	host-1
25M	host-2
31M	host-3


# ovirt-log-collector --log-size=100
...
log-collector-data]# du -skh /tmp/sosreport-LogCollector-20180126164815/log-collector-data/host-*
25M	host-1
25M	host-2
31M	host-3


# ovirt-log-collector
...
log-collector-data]# du -skh /tmp/sosreport-LogCollector-20180126164815/log-collector-data/host-*
25M	host-1
25M	host-2
31M	host-3

limiting log-size does not seem to have any effect.

Moving to ASSSIGNED for now, and adding needinfo on Ryan after the conversation with DEV. If there is anything I am not aware of please correct me and I'll reverify.

Comment 14 Ryan Barry 2018-01-29 23:09:58 UTC
Douglas -

I won't have an environment where I can look at this until next week. Can you take a look?

Comment 15 Ryan Barry 2018-01-30 12:51:25 UTC
Douglas, I'm reassigning this, as you're the maintainer.

The --log-size option is correctly passed to sosreport.

However, sosreport ignores this, because two conflicting sets of option are passed:

We are passing `-o logs,...` combined with `--all-logs` (or its equivalent for older versions). --all-logs ignores --log-size.

--all-logs is also unnecessary when combined with -o, which limits the set of options. I'm actually not sure what the behavior for sosreport is when these option are combined, so I'll leave it up to you.

Probably we want to remove --all-logs.

Comment 16 Sandro Bonazzola 2018-02-20 17:45:01 UTC
Moving to Ido since Douglas is on training this week

Comment 19 Yaniv Lavi 2018-06-12 11:59:00 UTC
Closing this RFE. Please reopen if still needed.
We have made considerable improvement to not get to this state.

Adding warning, limiting to one host per cluster and so on.

Comment 20 Franta Kust 2019-05-16 13:07:47 UTC
BZ<2>Jira Resync