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-1002: Add cloudwatch logforwarding type #839

Merged
merged 1 commit into from
Feb 18, 2021

Conversation

jcantrill
Copy link
Contributor

Description

This PR add logforwarding to Cloudwatch capabilities

/cc @igor-karpukhin
/assign @alanconway

Links

https://issues.redhat.com/browse/LOG-1002

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 15, 2020
@jcantrill jcantrill added release/4.7 and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Dec 15, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 15, 2020
@jcantrill
Copy link
Contributor Author

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 15, 2020
Copy link
Contributor

@alanconway alanconway left a comment

Choose a reason for hiding this comment

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

/lgtm

We may want to modify the naming and API but we should merge this as a first cut and work from there.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 16, 2020
@jcantrill
Copy link
Contributor Author

/retest

@jcantrill
Copy link
Contributor Author

jcantrill commented Dec 16, 2020

We may want to modify the naming and API but we should merge this as a first cut and work from there.

@alanconway since the API is not firm here, I hesitate to merge because then that IS the API. I'm still working to create TP branches where we could merge this and call it beta. That's ultimately what I would most desire to deliver for ROSA unless we are confident in the api

@alanconway
Copy link
Contributor

/lgtm cancel

Here's the API enhancement proposal: openshift/enhancements#570
Not a big change, has some small extra bits.

@openshift-ci-robot openshift-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed lgtm Indicates that a PR is ready to be merged. labels Dec 17, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 14, 2021
@jcantrill
Copy link
Contributor Author

@alanconway review comments please

@alanconway
Copy link
Contributor

LGTM but do we want to start the tech-preview branch for this?

@jcantrill jcantrill changed the base branch from master to tech-preview February 5, 2021 19:58
@jcantrill jcantrill force-pushed the LOG-1002 branch 2 times, most recently from 84fc4ac to a5e2f9f Compare February 11, 2021 19:16
Copy link
Contributor

@alanconway alanconway left a comment

Choose a reason for hiding this comment

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

Looks good, minor changes requested.

}
func (conf *outputLabelConf) LogGroupPrefix() string {
if conf.Target.Type == logging.OutputTypeCloudwatch {
prefix := conf.Target.Cloudwatch.GroupPrefix
Copy link
Contributor

Choose a reason for hiding this comment

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

Put the TrimSpace here so we check for "" and use the trimmed value.

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 don't believe I can do that without losing the ability to treat the following as different cases:

  • nil = use default
  • non-nil and not empty = use value

remove_log_group_name_key true
auto_create_stream true
concurrency 2
aws_key_id "#{open('{{ .SecretPath "aws_access_key_id"}}','r') do |f|f.read end}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Only set this if the key is found, otherwise we'll have a new crash loop when its missing. Here's what I did for the general TLS stuff:

{{- with $path := .SecretPathIfFound "tls.key"}}
tls_client_private_key_path "{{$path}}"
{{- end}}

Also if these keys are required, they should be checked as part of VerifyOutputSecret, but only for cloudwatch outputs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are absolutely required for the plugin to work. Will the generator code prior to the template successfully skip output generation for missing secrets?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added


//CLFVerifier is a collection of functions to control verification
//of ClusterLogForwarding
CLFVerifier ClusterLogForwarderVerifier
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure this is the best approach. We need to customize the verify behavior per-output, not for the whole forwarder,

Perhaps a map of map[string]VerifyFunc = { "cloudwatch": ...; "kafka": ... }, so Normalize can call the right verify func for each output type.

Copy link
Contributor Author

@jcantrill jcantrill Feb 15, 2021

Choose a reason for hiding this comment

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

This was added to allow the internal config generator bin to work without being connected to the cluster and really is not intended to be used otherwise. We can repurpose it if needed but ATM I don't meet the need.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, understood. However we still need different secret verification for cloudwatch (needs "aws_...") vs. other TLS outputs. We could have a global map of verify functions keyed by output type, and have output types with special needs put a function in the map that the validation code will call if not nil. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure. if that is needed seems reasonable

Copy link
Contributor

Choose a reason for hiding this comment

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

Not needed for this PR. This is OK

@jcantrill
Copy link
Contributor Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 16, 2021
Copy link
Contributor

@alanconway alanconway left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 18, 2021
@igor-karpukhin
Copy link
Contributor

/lgtm

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alanconway, igor-karpukhin, jcantrill

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:
  • OWNERS [alanconway,jcantrill]

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

@jcantrill
Copy link
Contributor Author

/retest

@openshift-merge-robot openshift-merge-robot merged commit 1848765 into openshift:tech-preview Feb 18, 2021
pmoogi-redhat pushed a commit to pmoogi-redhat/cluster-logging-operator that referenced this pull request Apr 26, 2022
LOG-1002: Add cloudwatch logforwarding type
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. lgtm Indicates that a PR is ready to be merged. release/5.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants