-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Initial commit for setting up a new component: k8slog receiver #24439
base: main
Are you sure you want to change the base?
Conversation
4858200
to
3e05fa1
Compare
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
remove stale |
3e05fa1
to
ea3a841
Compare
951c26c
to
04d4b40
Compare
) | ||
|
||
// Config is the configuration of a k8s input operator | ||
type Config struct { |
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.
Are all of the configuration options required for the initial implementation? Can you remove them for now and add them along with the functionality using them going forward?
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 agree, starting small will make things easier to review and get started and we can always add them in the future.
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.
receiver/k8slogreceiver/config.go
Outdated
|
||
// Expr represents the rules to filter containers based on a custom expression. | ||
// TODO: define the values passed to expr. | ||
Expr string `mapstructure:"expr"` |
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.
Lets not introduce expr
filtering to start. The other filter options you've provided are quite extensive. For expression language filtering I'd prefer we use OTTL.
stability: | ||
development: [logs] | ||
codeowners: | ||
active: [h0cheung] |
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.
You can add me here as well
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.
OK, I will do it soon.
) | ||
|
||
// Config is the configuration of a k8s input operator | ||
type Config struct { |
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 agree, starting small will make things easier to review and get started and we can always add them in the future.
04d4b40
to
6eb08af
Compare
82afa36
to
5fde154
Compare
@TylerHelmuth @dmitryax I've simplified the configs and added Tyler Helmuth to the code owner. Could you please have a look at this? |
receiver/k8slogreceiver/config.go
Outdated
// Env represents the rules to extract from container environment variables. | ||
Env []FieldExtractConfig `mapstructure:"env"` | ||
|
||
// OtelEnv represents the rules to extract from environment variables of otel itself. | ||
OtelEnv []FieldExtractConfig `mapstructure:"otel_env"` |
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 don't think we should allow extracting from env variables, that feels like a security risk.
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.
OtelEnv
has been removed.
However, Env
is needed in some cases. For example, if there are some environment variables in the docker image, there is no other way to get it.
Is this really risky? resourcedetection
supports it, and this component gets k8s node name from environment variables, too.
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.
Using an env var to filter feels ok. But this section is for taking fields from the pod and adding them as resource attributes to the log right?
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.
Getting attributes from environment variables is useful, and many components support it such as resoucedetection
Are there any reports of security risks associated with reading environment variables as strings and adding them to data?
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.
The risk is exposing apikey/password information, but that risk is lowered if the config only allows static strings. If we do allow this I think we can do all env vars with 1 config option, no need to split out OTel env vars.
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.
By default, the env
config is empty, and no variable will be exposed. When a user set this, he should know what he is doing.
It seems that otel_env
is necessary, so I've removed it in the latest commit.
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.
@dmitryax do you have an opinion?
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.
Any updates for this?
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.
Lets move forward with this allowed as we've discussed.
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 also find it useful to have the option to collect ENV_VAR information from the Pods.
That would give us important information about OTEL specific info like OTEL_SERVICE_NAME
.
Having service.name
populated in log records collected by the k8slog receiver is quite important since it will allow us to correlate logs with traces using the service.name
value.
132b260
to
8256f32
Compare
Remove stale |
Can we just temporarily drop his changes to get this merged? |
@h0cheung I have fixed the CLA issues on my side. At least I haven't got any errors the past 2 weeks on PRs/commits. In any case, I think there are still major open questions on this PR. |
/easycla |
b37ab49
to
1c6b049
Compare
1c6b049
to
9a9717a
Compare
@atoulme Are there any plans to integrate the k8slog receiver into the splunk-otel-collector after it becomes available through this merge request? |
09fca1f
to
cb65319
Compare
.github/CODEOWNERS
Outdated
reports/distributions/core.yaml @open-telemetry/collector-contrib-approvers | ||
reports/distributions/contrib.yaml @open-telemetry/collector-contrib-approvers | ||
reports/distributions/core.yaml @open-telemetry/collector-contrib-approvers | ||
reports/distributions/contrib.yaml @open-telemetry/collector-contrib-approvers | ||
|
||
|
||
## UNMAINTAINED components | ||
|
||
receiver/googlecloudspannerreceiver/ @open-telemetry/collector-contrib-approvers | ||
receiver/googlecloudspannerreceiver/ @open-telemetry/collector-contrib-approvers |
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.
you should not have manual edits to this file.
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.
regenerated
c02d865
to
076dead
Compare
076dead
to
2207485
Compare
Co-authored-by: Chris Mark <[email protected]>
2207485
to
aea45ae
Compare
Description:
k8slog receiver provides full functionality to collect logs in k8s containers. It is an all-in-one solution, which supports to:
If we want to collect logs from k8s, we can use this component.
Link to tracking Issue:
#23339
Testing:
Tests for unmarshaling configuration have been added.
Documentation:
Docs for configurations and overall design has been added.