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

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

Open
m350 opened this issue Jan 15, 2024 · 3 comments
Open

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

m350 opened this issue Jan 15, 2024 · 3 comments
Labels
kind/documentation Categorizes issue or PR as related to documentation. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@m350
Copy link

m350 commented Jan 15, 2024

Link to the issue (please include a link to the specific documentation or example):
In #199 (comment)
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 m350 added the kind/documentation Categorizes issue or PR as related to documentation. label Jan 15, 2024
@roycaihw
Copy link
Member

Could you elaborate what's the ask here?

@m350
Copy link
Author

m350 commented Feb 14, 2024

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.

@k8s-triage-robot
Copy link

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-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/documentation Categorizes issue or PR as related to documentation. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

4 participants