Giter Club home page Giter Club logo

Comments (9)

pires avatar pires commented on May 27, 2024

One more option is --since. This makes me think we must consider all logging options.

from systemk.

pires avatar pires commented on May 27, 2024

Also, something I realized during my tests is that if a unit with the same name ran in the past, there's the chance logs are still around which doesn't seem a good thing.

A quick search led me to learn journalctl allows for vacuum the logs but only archived ones, so something like this could work:

journalctl --rotate
journalctl --vacuum-time=1s

from systemk.

pires avatar pires commented on May 27, 2024

Also, something I realized during my tests is that if a unit with the same name ran in the past, there's the chance logs are still around which doesn't seem a good thing.

A quick search led me to learn journalctl allows for vacuum the logs but only archived ones, so something like this could work:

Recreation of pods where the name sticks is usually a thing only when dealing with naked Pods (not under the control of any envelope, such as Deployment) or StatefulSets, eg my-pod-0. But this is enough to justify, I think, some sort of logic here that avoids fetching logs from previous instances of a homonym Pod.

An alternative to what I proposed earlier, is to have the provider enforce journald entries that have been created since after the current Pod instance started. Since the provider has access to informers cache (the current code doesn't have access to the Pod informer but we can change that), we can easily retrieve the starttime attribute and compute based on that.

WDYT @miekg?

from systemk.

miekg avatar miekg commented on May 27, 2024

Also, something I realized during my tests is that if a unit with the same name ran in the past, there's the chance logs are still around which doesn't seem a good thing.

I don't think this is bad, this could actually be helpful. And anyway if journald works like this we should not jump through hoops to make it work differently.

from systemk.

pires avatar pires commented on May 27, 2024

It's not much about systemd but about the fact that you'll get logs from Pod instances that no longer exist and/or never belonged to you. What if user A runs Pod xyz, prints some data, deletes Pod, and then user B runs a Pod with same name: is it ok for user B to get logs from a workload instance they didn't own? In the containerized Kubernetes world, even when journald is the log sink, it is guaranteed the logs pertain only to the instance of the Pod you're retrieving logs for.

from systemk.

pires avatar pires commented on May 27, 2024

Another alternative, and way more easy, is to append Pod UID to the the systemd unit name, hence guaranteeing uniqueness.

from systemk.

miekg avatar miekg commented on May 27, 2024

from systemk.

pires avatar pires commented on May 27, 2024

I think I'm too tied to how the kubelet does things and to keep UX parity when possible.

Anyway, I think it's fine to leave it for now and if it becomes a problem later it will be easy to address.

from systemk.

miekg avatar miekg commented on May 27, 2024

from systemk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.