-
Notifications
You must be signed in to change notification settings - Fork 542
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
[openshift_ovn] Collect additional ovnkube node logs #3336
[openshift_ovn] Collect additional ovnkube node logs #3336
Conversation
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
sos/report/plugins/openshift_ovn.py
Outdated
self.add_copy_spec([ | ||
"/var/lib/ovn-ic/etc/*log*" | ||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be a one-line addition to the add_copy_spec()
call above, since we're working in the same directory. Also, a_c_s accepts single strings as well as lists if this were to be kept separate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK @TurboTurtle , moved this log path into existing list.
sos/report/plugins/openshift_ovn.py
Outdated
@@ -32,6 +32,10 @@ def setup(self): | |||
"/var/lib/ovn-ic/etc/ovnnb_db.db", | |||
"/var/lib/ovn-ic/etc/ovnsb_db.db" | |||
]) | |||
# Collect additional ovnkube logs for interconnect setup. | |||
self.add_copy_spec([ | |||
"/var/lib/ovn-ic/etc/*log*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also like to know what kind of logs are here, capturing every log file by default may not be ideal if there are other components logging here or if there is significant log rotation happening.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @TurboTurtle reasonable questions. With the ovn-ic feature, we opted for having the libovsdb logs separate from the regular ovnkube controller. General details on this feature are here:
https://issues.redhat.com/browse/OCPSTRAT-379
More info on the logs are here: https://issues.redhat.com/browse/SDN-3507
CNO PR: openshift/cluster-network-operator#1938
The logs are rotated via lumberjack and have the following values: 100Mb (uncompressed) and 5 rotated and compressed. With that, the worst case scenario will mean that the the SOS will have less than 500Mb.
How about we restrict the log files to use "libovsdblog" wildcard?
Here is an example output of what the files look like:
❯ POD=$(oc get pod -n openshift-ovn-kubernetes -l app=ovnkube-node -o jsonpath='{.items[0].metadata.name}')
ocn exec -it $POD -c ovnkube-controller -- bash -c "ls -lah /var/log/ovnkube/libovsdb*log*"
-rw-r-----. 1 root root 41K Aug 14 19:45 /var/log/ovnkube/libovsdb-2023-08-14T19-45-34.678.log.gz
-rw-r-----. 1 root root 660K Aug 14 23:38 /var/log/ovnkube/libovsdb.log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about collecting /var/log/ovnkube/*log*
when --all-logs
is specified, and /var/log/ovnkube/*.log
otherwise. This follows the same kind of scenario for many of the plugins. This ensures that the size of sosreport is not as big if --all-logs
is not specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say we want to have these files collected by default (since communicating the right flags that should be used is not that easy and may result in losing precious data), and we know this plugin is only active for openshift nodes, so this change shouldn't affect the majority of setups, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prevailing approach in sos plugins is to capture *.log
normally, and get *log*
when either --all-logs
or some plugin-specific option is used.
The sizelimit
parameter here applies per item (in a list) handed to add_copy_spec
, not the entire call or the individual matches for a regex (meaning a sizelimit
setting of 600 is a bit heavy handed). So, another option would be having one entry for *.log
and another for *.log.gz
and setting sizelimit to 100 meaning by default we'd capture the active log and up to 100 MB of rotated logs. If something truly needs all the rotated logs, then that's where --all-logs
would come into play.
Would that be a reasonable middle ground?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@npinaeva @TurboTurtle @arif-ali , Thanks! Based on your concerns and suggestions, updated the log collection with commit b098433, Is that ok now ?
e3873b5
to
ee135ac
Compare
sos/report/plugins/openshift_ovn.py
Outdated
"/var/log/openvswitch/ovs-monitor-ipsec.log" | ||
]) | ||
else: | ||
self.add_copy_spec("/var/log/openvswitch") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This folder is also collected in the openvswitch
plugin, so you could have a conflict of collections. It may be better to target the logname and asterisk. or better yet, if the openvswitch
plugin does get activated on an openshift node, that these items could be added to that plugin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this is mainly to collect ipsec related logs on ovn
/openvswitch
setup.
now collecting only ipsec logs from ovn plugin when --all-logs option is not set.
cc70b68
to
b098433
Compare
sos/report/plugins/openshift_ovn.py
Outdated
self.add_copy_spec(["/var/lib/ovn-ic/etc/libovsdb.log", | ||
"/var/lib/ovn-ic/etc/libovsdb*log.gz"], | ||
sizelimit=100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick on style guidelines, this should be
self.add_copy_spec([
"/var/lib/ovn-ic/etc/libovsdb.log",
"/var/lib/ovn-ic/etc/libovsdb*log.gz"
], sizelimit=100)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
b098433
to
d2be21d
Compare
sos/report/plugins/openshift_ovn.py
Outdated
self.add_copy_spec([ | ||
"/var/log/openvswitch/libreswan.log", | ||
"/var/log/openvswitch/ovs-monitor-ipsec.log" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was it moved here? I would say we need these logs even when all_logs is set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, these file patterns dont seem to be collected in all_logs (not sure if intentionally or by mistake).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/var/log/openvswitch
is already being captured by the openvswitch
plugin. Would that not be activated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have seen several such feedbacks that a PR wants to collect a copypath in another plugin; maybe does it make sense to have a CI test for it? Though it can be tricky to have it working properly (e.g. due to multiline a_s_c, asterisks in paths, paths with variables etc)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be collected for openvswitch plugin, but I don't think that happens for some reason, may be useful to check/debug that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok @npinaeva , I will check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, thanks for checking! then we can just remove these files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed collecting ipsec logs from /var/log/openvswitch
directory.
With Interconnect support in latest OVN-Kubernetes, ovnkube-nodes logs grew large. This commit adds the ability to collect those additional logs. Signed-off-by: Periyasamy Palanisamy <[email protected]>
The sosreport limits to collect logs at maximum of 25 MB in a given collection passed into add_copy_spec method. so this may lead into logs wouldn't have fully collected when user collected sos report without --all-logs option. Hence this commit ensures logs and dbs collected as much as possible when --all-logs option is not specified. Signed-off-by: Periyasamy Palanisamy <[email protected]>
d2be21d
to
d8b417b
Compare
/lgtm |
With Interconnect support in latest OVN-Kubernetes, ovnkube-nodes logs grew large. This commit adds the ability to collect those additional logs.
Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines