Skip to content

LOG-6860: Support Splunk Metadata keys in ClusterLogForwarder #2999

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

Merged
merged 1 commit into from
Apr 21, 2025

Conversation

vparfonov
Copy link
Contributor

Description

This PR addressed to extend the ClusterLogForwarder to support Splunk metadata fields when forwarding logs
so that we enable better integration with Splunk.

/cc @Clee2691 @cahartma
/assign @jcantrill

/cherry-pick

Links

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 26, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 26, 2025

@vparfonov: This pull request references LOG-6860 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.8.0" version, but no target version was set.

In response to this:

Description

This PR addressed to extend the ClusterLogForwarder to support Splunk metadata fields when forwarding logs
so that we enable better integration with Splunk.

/cc @Clee2691 @cahartma
/assign @jcantrill

/cherry-pick

Links

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 openshift-eng/jira-lifecycle-plugin repository.

@cahartma
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 27, 2025
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 27, 2025
payload := string(spec.Splunk.PayloadKey)
for _, v := range spec.Splunk.IndexedFields {
if !strings.HasPrefix(string(v), payload) {
results = append(results, fmt.Sprintf("Indexed field: %s not part of payload: %s", v, payload))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we trying to restrict they payload field from being part of indexed fields? If so then the error should read that it can not or is not allowed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indexed fields can't be outside of a given payload

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this to be a reasonable restriction even though it is the behavior of the encoder. Use the audit event example from the feature request where they are indexing annotations but the "event"/payload field comes from a sibling node in the original message. We should be able to copy the fields in question to the "root" of the message so the encoder picks them up while setting the payload to something else.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you are right, this checks are overhead and not clear. I will remove this

@jcantrill
Copy link
Contributor

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 27, 2025
@vparfonov vparfonov requested a review from jcantrill March 28, 2025 12:18
@vparfonov
Copy link
Contributor Author

/test functional-target

1 similar comment
@vparfonov
Copy link
Contributor Author

/test functional-target

@vparfonov vparfonov marked this pull request as draft March 28, 2025 20:31
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 28, 2025
@vparfonov
Copy link
Contributor Author

/test functional-target

7 similar comments
@vparfonov
Copy link
Contributor Author

/test functional-target

@vparfonov
Copy link
Contributor Author

/test functional-target

@vparfonov
Copy link
Contributor Author

/test functional-target

@vparfonov
Copy link
Contributor Author

/test functional-target

@vparfonov
Copy link
Contributor Author

/test functional-target

@vparfonov
Copy link
Contributor Author

/test functional-target

@vparfonov
Copy link
Contributor Author

/test functional-target

@vparfonov vparfonov marked this pull request as ready for review March 31, 2025 11:12
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 31, 2025
@vparfonov
Copy link
Contributor Author

/test e2e-target

// A dynamic value is encased in single curly brackets `{}` and MUST end with a static fallback value separated with `||`.
// Static values can only contain alphanumeric characters along with dashes, underscores, dots and forward slashes.
// If not specified will be detected according to .log_source and .log_type value.
// Details see in: docs/features/logforwarding/outputs/splunk-forwarding.adoc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will have to be a full link URL to be useful. Ideally it would be to the released branch instead of 'master' but that will have to do until we release

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i will change this after we will release

payload := string(spec.Splunk.PayloadKey)
for _, v := range spec.Splunk.IndexedFields {
if !strings.HasPrefix(string(v), payload) {
results = append(results, fmt.Sprintf("Indexed field: %s not part of payload: %s", v, payload))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this to be a reasonable restriction even though it is the behavior of the encoder. Use the audit event example from the feature request where they are indexing annotations but the "event"/payload field comes from a sibling node in the original message. We should be able to copy the fields in question to the "root" of the message so the encoder picks them up while setting the payload to something else.

@jcantrill
Copy link
Contributor

/approve

Copy link
Contributor

openshift-ci bot commented Apr 9, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jcantrill, vparfonov

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 9, 2025
@jcantrill
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. and removed lgtm Indicates that a PR is ready to be merged. labels Apr 9, 2025
@vparfonov
Copy link
Contributor Author

/retest

@jcantrill
Copy link
Contributor

/hold cancel
/lgtm

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 21, 2025
@jcantrill
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 21, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit 9c6f260 into openshift:master Apr 21, 2025
6 of 8 checks passed
@openshift-cherrypick-robot

@vparfonov: cannot checkout <!--: error checking out "<!--": exit status 1 error: pathspec '<!--' did not match any file(s) known to git

In response to this:

Description

This PR addressed to extend the ClusterLogForwarder to support Splunk metadata fields when forwarding logs
so that we enable better integration with Splunk.

/cc @Clee2691 @cahartma
/assign @jcantrill

/cherry-pick

Links

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. release/6.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants