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

LOG-3527: Collector to act as rsyslog server #2221

Closed
wants to merge 6 commits into from

Conversation

jlarriba
Copy link
Contributor

Description

The included modifications generate an rsyslog server configuration for Collector. This configuration does not currently apply any transformations and expects an "external" tenant existing in Loki to which send the logs to.

/cc syedriko
/assign jcantrill

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 Oct 26, 2023
@openshift-ci-robot
Copy link

openshift-ci-robot commented Oct 26, 2023

@jlarriba: This pull request references LOG-3527 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 epic to target the "4.8.0" version, but no target version was set.

In response to this:

Description

The included modifications generate an rsyslog server configuration for Collector. This configuration does not currently apply any transformations and expects an "external" tenant existing in Loki to which send the logs to.

/cc syedriko
/assign jcantrill

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/test-infra repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 26, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jlarriba
Once this PR has been reviewed and has the lgtm label, please ask for approval from jcantrill. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

key_file = "/etc/collector/{{.ID}}/tls.key"
crt_file = "/etc/collector/{{.ID}}/tls.crt"

[transforms.{{.ID}}_split]
Copy link
Contributor

Choose a reason for hiding this comment

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

these transforms are specific to k8s audit logs. I'd drop them first and then see what remaps if any are needed.

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 be working precisely on this, I am ramping up with Vector's transform syntax

// Port the Service and the HTTP listener listen on.
// +kubebuilder:default:=10514
// +optional
Port int32 `json:"port"`
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason to support UDP?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will add UDP support while merging the common options in a ReceiverTypeSpec

@@ -197,12 +200,14 @@ func verifyInputs(spec *loggingv1.ClusterLogForwarderSpec, status *loggingv1.Clu
badInput("inputspec cannot have a negative limit threshold")
case input.Receiver != nil && !extras[constants.VectorName]:
badInput("ReceiverSpecs are only supported for the vector log collector")
case input.Receiver != nil && input.Receiver.HTTP == nil:
badInput("ReceiverSpec must define an HTTP receiver")
case input.Receiver != nil && input.Receiver.HTTP == nil && input.Receiver.Syslog == nil:
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 think we want both HTTP and Syslog defined for a receiver.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why not? They are intended for different things and serve different purposes.

Copy link
Contributor

@syedriko syedriko Oct 27, 2023

Choose a reason for hiding this comment

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

I'll defer to @alanconway for the final word, but I think it would complicate both upstream - k8s service - as well as downstream - vector xforms - plumbing if we try to support multiple protocols, or even multiple payload formats, over the same receiver.
There can be many receivers in a CLF though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah true, for sure we do not want to have two protocols over the same receiver. For having two different receivers we should create two different inputs. Im going to fix this.

@@ -120,6 +120,41 @@ var _ = Describe("Validate clusterlogforwarderspec", func() {
checkReceiver(&loggingv1.ReceiverSpec{}, `ReceiverSpecs are only supported for the vector log collector`, map[string]bool{})
})

It("should fail validation for invalid Syslog receiver specs", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

may be we can collapse this together with the HTTP receiver test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We might, but I think it is more readable if we keep them separate, just to save some "if"s in there.

checkReceiver(&loggingv1.ReceiverSpec{}, `ReceiverSpec must define an Syslog receiver`, map[string]bool{constants.VectorName: true})
checkReceiver(&loggingv1.ReceiverSpec{}, `ReceiverSpecs are only supported for the vector log collector`, map[string]bool{})
})

Copy link
Contributor

Choose a reason for hiding this comment

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

need a negative test here for both HTTP and Syslog receivers defined together.

Copy link
Contributor Author

@jlarriba jlarriba Oct 27, 2023

Choose a reason for hiding this comment

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

i think HTTP and Syslog defined together is not something we would like to prevent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, we should add this test

@jlarriba
Copy link
Contributor Author

jlarriba commented Nov 6, 2023

/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 Nov 6, 2023
Copy link
Contributor

openshift-ci bot commented Nov 6, 2023

@jlarriba: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/unit 9ea6212 link true /test unit

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

@jlarriba
Copy link
Contributor Author

jlarriba commented Nov 7, 2023

This PR has been superseded by a new one: #2235

There, I remove the need for an external Loki tenant, add a ReceiverTypeSpec and address the review comments.

@jlarriba jlarriba closed this Nov 7, 2023
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 7, 2023
@openshift-merge-robot
Copy link
Contributor

PR needs rebase.

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/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants