-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(kubernetes_logs source) support k8s API based logs #24007
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
base: master
Are you sure you want to change the base?
Conversation
src/sources/kubernetes_logs/mod.rs
Outdated
rotate_wait: Duration, | ||
|
||
/// Whether use k8s logs API or not | ||
api_log: bool, |
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.
Nit: would be better if we named this log_collection_strategy
and support disk
and api
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 idea!
@pront , I have introduced the new config named Hope that the whole strucuture is good, and then we could focus on the temporary workaround to handle the |
return; | ||
// TODO: fix it until `FunctionTransform` supports Api logs | ||
// emit!(ParserMatchError { value: &s[..] }); | ||
drop(log.insert(&message_path, Value::Bytes(s))); |
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 know this is a ugly workaround. For more reasonable PR review size, I dropped the implementation of FunctionTransform
trait for Api
here (which is very similar to how Cri handle the logs).
Summary
As dicussed in #23597 and #23982, I intend to support Kubernetes logs API to tail the pods logs in this PR.
Features Implemented
log_collection_strategy
configuration option to enable log collection via Kubernetes API instead of file-based tailingPodInfo
struct for essential pod metadata extraction and container trackingTODO Items
Vector configuration
How did you test this PR?
Given the following kind cluster config named
kind-cluster.yaml
Create kind clulster from config
Export the cluster's kubeconfig to
kind-kubeconfig
kind export kubeconfig --kubeconfig kind-kubeconfig
Apply the following manifest to kind's cluster
Build vector with nessary features and run the given config.
Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changelog
label to this PR.References
Notes
@vectordotdev/vector
to reach out to us regarding this PR.pre-push
hook, please see this template.make fmt
make check-clippy
(if there are failures it's possible some of them can be fixed withmake clippy-fix
)make test
git merge origin master
andgit push
.Cargo.lock
), pleaserun
make build-licenses
to regenerate the license inventory and commit the changes (if any). More details here.