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

There are no plugin to gater K8s/OCP rotated logs #3677

Closed
Akrog opened this issue Jun 17, 2024 · 0 comments · Fixed by #3678
Closed

There are no plugin to gater K8s/OCP rotated logs #3677

Akrog opened this issue Jun 17, 2024 · 0 comments · Fixed by #3678

Comments

@Akrog
Copy link
Contributor

Akrog commented Jun 17, 2024

On Kubernetes/OpenShift nodes when the logs are rotated there is no way to get them in an sos report.

It is true than in most cases there is a centralized log solution, but in some other it is convenient to be able to get these logs.

All rotated logs are present under /var/log/pods which cannot be retrieved any way:

  • Not using container_logs plugin, since it only gathers the logs symlinked in /var/log/containers
  • Not using the openshift plugin, as it is only able to get the current logs using oc logs.
Akrog added a commit to Akrog/sos that referenced this issue Jun 17, 2024
In Kubernetes/OpenShift rotated logs have no symbolic link in
/var/log/containers and they cannot be retrieved using `oc logs` either,
so there is no way to get these rotated logs in a SOS report.

This patch proposes a new plugin called `pod_log`, similar to the
xisting `container_log`, that can retrieve rotated logs for the
containers.

The plugin will not only download the `/var/log/pods` files but also the
`/var/log/container` symlinks.

The plugin doesn't use the `all_logs` flag, since the usage of the
plugin assumes the intent of getting rotated logs, otherwise the
`container_log` plugin can be used.

An alternative would be to extend the existing `container_log` plugin to
also retrieve rotated container logs.  This approach has been discarded
because we would either have to modify existing behavior for the
`all_logs` flag (breaking backward compatibility) or add a new parser
arguments just to tell it to also gather rotated logs (not reasonable).

Closes sosreport#3677
Signed-off-by: Gorka Eguileor <geguileo@redhat.com>
Akrog added a commit to Akrog/sos that referenced this issue Jun 17, 2024
In Kubernetes/OpenShift rotated logs have no symbolic link in
/var/log/containers and they cannot be retrieved using `oc logs` either,
so there is no way to get these rotated logs in a SOS report.

This patch proposes a new plugin called `pod_log`, similar to the
xisting `container_log`, that can retrieve rotated logs for the
containers.

The plugin will not only download the `/var/log/pods` files but also the
`/var/log/container` symlinks.

The plugin doesn't use the `all_logs` flag, since the usage of the
plugin assumes the intent of getting rotated logs, otherwise the
`container_log` plugin can be used.

An alternative would be to extend the existing `container_log` plugin to
also retrieve rotated container logs.  This approach has been discarded
because we would either have to modify existing behavior for the
`all_logs` flag (breaking backward compatibility) or add a new parser
arguments just to tell it to also gather rotated logs (not reasonable).

Closes sosreport#3677
Signed-off-by: Gorka Eguileor <geguileo@redhat.com>
Akrog added a commit to Akrog/sos that referenced this issue Jun 17, 2024
In Kubernetes/OpenShift rotated logs have no symbolic link in
/var/log/containers and they cannot be retrieved using `oc logs` either,
so there is no way to get these rotated logs in a SOS report.

This patch proposes a new plugin called `pod_log`, similar to the
xisting `container_log`, that can retrieve rotated logs for the
containers.

The plugin will not only download the `/var/log/pods` files but also the
`/var/log/container` symlinks.

The plugin doesn't use the `all_logs` flag, since the usage of the
plugin assumes the intent of getting rotated logs, otherwise the
`container_log` plugin can be used.

An alternative would be to extend the existing `container_log` plugin to
also retrieve rotated container logs.  This approach has been discarded
because we would either have to modify existing behavior for the
`all_logs` flag (breaking backward compatibility) or add a new parser
arguments just to tell it to also gather rotated logs (not reasonable).

Closes sosreport#3677
Signed-off-by: Gorka Eguileor <geguileo@redhat.com>
Akrog added a commit to Akrog/sos that referenced this issue Jun 20, 2024
In Kubernetes/OpenShift rotated logs have no symbolic link in
/var/log/containers and they cannot be retrieved using `oc logs` either,
so there is no way to get these rotated logs in a SOS report.

This patch proposes extending the `container_log` to make it also
capable of retrieving logs from `var/log/pods` using a plugin boolean
option called `rotated`.

When retrieving the pods directory, all logs will be retrieved from it
regardless of size, as it is implicit that the intent is to get all
rotated logs.

Closes sosreport#3677
Signed-off-by: Gorka Eguileor <geguileo@redhat.com>
Akrog added a commit to Akrog/sos that referenced this issue Jun 20, 2024
In Kubernetes/OpenShift rotated logs have no symbolic link in
/var/log/containers and they cannot be retrieved using `oc logs` either,
so there is no way to get these rotated logs in a SOS report.

This patch proposes extending the `container_log` to make it also
capable of retrieving logs from `var/log/pods` using a plugin boolean
option called `rotated`.

When retrieving the pods directory, all logs will be retrieved from it
regardless of size, as it is implicit that the intent is to get all
rotated logs.

Closes sosreport#3677
Signed-off-by: Gorka Eguileor <geguileo@redhat.com>
Akrog added a commit to Akrog/sos that referenced this issue Jun 20, 2024
In Kubernetes/OpenShift rotated logs have no symbolic link in
/var/log/containers and they cannot be retrieved using `oc logs` either,
so there is no way to get these rotated logs in a SOS report.

This patch proposes extending the `container_log` to make it also
capable of retrieving logs from `var/log/pods` using a plugin boolean
option called `rotated`.

When retrieving the pods directory, all logs will be retrieved from it
regardless of size, as it is implicit that the intent is to get all
rotated logs.

This patch also adds the `maxage` option to the `container_log` plugin,
allowing the retrieval of logs that are not older than `maxage` hours.

This affects bot the normal containers log gathering as well as the pods
gathering.

Closes sosreport#3677
Signed-off-by: Gorka Eguileor <geguileo@redhat.com>
Akrog added a commit to Akrog/sos that referenced this issue Jun 21, 2024
In Kubernetes/OpenShift rotated logs have no symbolic link in
/var/log/containers and they cannot be retrieved using `oc logs` either,
so there is no way to get these rotated logs in a SOS report.

This patch proposes extending the `container_log` plugin to make it also
capable of retrieving rotated logs from `var/log/pods` using a plugin
boolean option called `rotated`.

Closes sosreport#3677
Signed-off-by: Gorka Eguileor <geguileo@redhat.com>
Akrog added a commit to Akrog/sos that referenced this issue Jun 24, 2024
In Kubernetes/OpenShift rotated logs have no symbolic link in
/var/log/containers and they cannot be retrieved using `oc logs` either,
so there is no way to get these rotated logs in a SOS report.

This patch proposes extending the `container_log` plugin to make it also
capable of retrieving rotated logs from `var/log/pods` using a plugin
boolean option called `rotated`.

Closes sosreport#3677
Signed-off-by: Gorka Eguileor <geguileo@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant