python icon indicating copy to clipboard operation
python copied to clipboard

Way to get only current logs, without follow and line by line

Open m350 opened this issue 1 year ago • 4 comments

Link to the issue (please include a link to the specific documentation or example): In https://github.com/kubernetes-client/python/issues/199#issuecomment-614084830 we see example of getting logs until interrupt. Description of the issue (please include outputs or screenshots if possible): We don't have straight way to get only part of logs line by line.

I found how we can use current code to achieve this

import kubernetes

configuration= kubernetes.config.load_kube_config()
with kubernetes.client.ApiClient(configuration) as api_client:
Corev1Api = kubernetes.client.CoreV1Api(api_client)
resp = Corev1Api.read_namespaced_pod_log( name=pod_name, namespace=namespace_name , _preload_content=False)
  for line in kubernetes.watch.watch.iter_resp_lines(resp):
    print(line)

m350 avatar Jan 15 '24 14:01 m350

Could you elaborate what's the ask here?

roycaihw avatar Feb 12 '24 17:02 roycaihw

Could you elaborate what's the ask here?

There is no question asked. I found the way of using python module for Kubernetes to get data line by line. I suggest to add this info to docs. I found that it may be helpful.

m350 avatar Feb 14 '24 07:02 m350

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar May 14 '24 07:05 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Jun 13 '24 08:06 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-triage-robot avatar Jul 13 '24 08:07 k8s-triage-robot

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Jul 13 '24 08:07 k8s-ci-robot