From a1c0b943f07b5287dd4852a5c8c4abbcf50c47d6 Mon Sep 17 00:00:00 2001 From: Cody Jackson Date: Thu, 3 Dec 2020 17:01:59 -0700 Subject: [PATCH] Adding new logging Outputs and ClusterOutputs - Also added ssl/ca to Forward, Loki and Splunk rancher/dashboard#1191 --- assets/translations/en-us.yaml | 81 +++++++++++++++- edit/logging.banzaicloud.io.output/index.vue | 27 +++--- .../providers/awsElasticsearch.vue | 64 +++++++++++++ .../providers/azurestorage.vue | 73 ++++++++++++++ .../providers/cloudwatch.vue | 68 +++++++++++++ .../providers/datadog.vue | 75 +++++++++++++++ .../providers/file.vue | 38 ++++++++ .../providers/forward.vue | 37 +++++++ .../providers/gcs.vue | 77 +++++++++++++++ .../providers/kinesisStream.vue | 65 +++++++++++++ .../providers/logdna.vue | 52 ++++++++++ .../providers/logz.vue | 88 +++++++++++++++++ .../providers/loki.vue | 37 +++++++ .../providers/newrelic.vue | 65 +++++++++++++ .../providers/s3.vue | 96 +++++++++++++++++++ .../providers/splunkHec.vue | 40 ++++++++ .../providers/sumologic.vue | 56 +++++++++++ models/logging.banzaicloud.io.output.js | 83 +++++++++++++--- 18 files changed, 1093 insertions(+), 29 deletions(-) create mode 100644 edit/logging.banzaicloud.io.output/providers/awsElasticsearch.vue create mode 100644 edit/logging.banzaicloud.io.output/providers/azurestorage.vue create mode 100644 edit/logging.banzaicloud.io.output/providers/cloudwatch.vue create mode 100644 edit/logging.banzaicloud.io.output/providers/datadog.vue create mode 100644 edit/logging.banzaicloud.io.output/providers/file.vue create mode 100644 edit/logging.banzaicloud.io.output/providers/gcs.vue create mode 100644 edit/logging.banzaicloud.io.output/providers/kinesisStream.vue create mode 100644 edit/logging.banzaicloud.io.output/providers/logdna.vue create mode 100644 edit/logging.banzaicloud.io.output/providers/logz.vue create mode 100644 edit/logging.banzaicloud.io.output/providers/newrelic.vue create mode 100644 edit/logging.banzaicloud.io.output/providers/s3.vue create mode 100644 edit/logging.banzaicloud.io.output/providers/sumologic.vue diff --git a/assets/translations/en-us.yaml b/assets/translations/en-us.yaml index 94cc9e505c..7cb8f2cc73 100644 --- a/assets/translations/en-us.yaml +++ b/assets/translations/en-us.yaml @@ -748,13 +748,71 @@ logging: configureKubernetesLabels: Configure Kubernetes metadata in a Prometheus like format extractKubernetesLabels: Extract Kubernetes labels as Loki labels dropSingleKey: If a record only has 1 key, then just set the log line to the value and discard the key + caCert: CA Cert + cert: Cert + key: Key + awsElasticsearch: + url: URL + keyId: Key Id + secretKey: Secret Key + azurestorage: + storageAccount: Storage Account + accessKey: Access Key + container: Container + path: Path + storeAs: Store As + cloudwatch: + keyId: Key Id + secretKey: Secret Key + endpoint: Endpoint + region: Region + datadog: + apiKey: API Key + useSSL: Use SSL + useCompression: Use Compression + host: Host + file: + path: Path + gcs: + project: Project + credentialsJson: Credentials Json + bucket: Bucket + path: Path + overwriteExistingPath: Overwrite Existing Path + kinesisStream: + streamName: Stream Name + keyId: Key Id + secretKey: Secret Key + logdna: + apiKey: API Key + hostname: Hostname + app: App + logz: + url: URL + port: Port + token: Api Token + enableCompression: Enable Compression + newrelic: + apiKey: API Key + licenseKey: License Key + baseURI: Base URI + sumologic: + endpoint: Endpoint + sourceName: Source Name + s3: + keyId: Key Id + secretKey: Secret Key + endpoint: Endpoint + bucket: Bucket + path: Path + overwriteExistingPath: Overwrite Existing Path output: selectOutputs: Select Outputs selectBanner: Select to configure an output sections: target: Target access: Access - certificate: SSL + certificate: Connection labels: Labels outputProviders: elasticsearch: Elasticsearch @@ -762,6 +820,18 @@ logging: kafka: Kafka forward: Fluentd loki: Loki + awsElasticsearch: Amazon Elasticsearch + azurestorage: Azure Storage + cloudwatch: Cloudwatch + datadog: Datadog + file: File + gcs: GCS + kinesisStream: Kinesis Stream + logdna: LogDNA + logz: LogZ + newrelic: New Relic + sumologic: SumoLogic + s3: S3 unknown: Unknown overview: poweredBy: Banzai Cloud @@ -774,17 +844,22 @@ logging: protocol: Protocol index: Index token: Token - clientCert: Client Cert - clientKey: Client Key insecureSsl: Insecure SSL indexName: Index Name source: Source + caFile: CA File + caPath: CA Path + clientCert: Client Cert + clientKey: Client Key forward: host: Host port: Port sharedKey: Shared Key username: Username password: Password + clientCertPath: Client Cert Path + clientPrivateKeyPath: Client Private Key Path + clientPrivateKeyPassphrase: Client Private Key Passphrase longhorn: overview: diff --git a/edit/logging.banzaicloud.io.output/index.vue b/edit/logging.banzaicloud.io.output/index.vue index 38c36a2197..6983910a42 100644 --- a/edit/logging.banzaicloud.io.output/index.vue +++ b/edit/logging.banzaicloud.io.output/index.vue @@ -5,19 +5,21 @@ import Tabbed from '@/components/Tabbed'; import Tab from '@/components/Tabbed/Tab'; import CruResource from '@/components/CruResource'; import NameNsDescription from '@/components/form/NameNsDescription'; -import ToggleGradientBox from '@/components/ToggleGradientBox'; import Labels from '@/components/form/Labels'; import LabeledSelect from '@/components/form/LabeledSelect'; import Banner from '@/components/Banner'; import { PROVIDERS } from '@/models/logging.banzaicloud.io.output'; import { _VIEW } from '@/config/query-params'; +import { clone } from '@/utils/object'; +import isEqual from 'lodash/isEqual'; +import isEmpty from 'lodash/isEmpty'; export default { components: { - Banner, CruResource, Labels, LabeledSelect, NameNsDescription, Tab, Tabbed, ToggleGradientBox + Banner, CruResource, Labels, LabeledSelect, NameNsDescription, Tab, Tabbed }, - mixins: [CreateEditView, ToggleGradientBox], + mixins: [CreateEditView], async fetch() { await this.$store.dispatch('cluster/findAll', { type: SECRET }); @@ -34,18 +36,19 @@ export default { label: this.t(provider.labelKey) })); - this.value.spec = this.value.spec || {}; + if (this.mode !== _VIEW) { + this.$set(this.value, 'spec', this.value.spec || {}); - providers.forEach((provider) => { - this.value.spec[provider.name] = this.value.spec[provider.name] || provider.default; - }); + providers.forEach((provider) => { + this.$set(this.value.spec, provider.name, this.value.spec[provider.name] || clone(provider.default)); + }); + } const selectedProviders = providers.filter((provider) => { const specProvider = this.value.spec[provider.name]; - const correctedSpecProvider = provider.name === 'forward' ? specProvider.servers[0] : specProvider; - const specProviderKeys = Object.keys(correctedSpecProvider || {}).filter(key => !['format', 'configure_kubernetes_labels'].includes(key)); + const correctedSpecProvider = provider.name === 'forward' ? specProvider?.servers?.[0] || {} : specProvider; - return specProviderKeys.length > 0; + return !isEmpty(correctedSpecProvider) && !isEqual(correctedSpecProvider, provider.default); }); return { @@ -115,12 +118,12 @@ export default { -
+
- +
+import LabeledInput from '@/components/form/LabeledInput'; +import SecretSelector from '@/components/form/SecretSelector'; + +export default { + components: { LabeledInput, SecretSelector }, + props: { + value: { + type: Object, + default: () => { + return {}; + } + }, + disabled: { + type: Boolean, + default: false + }, + mode: { + type: String, + required: true, + }, + } +}; + + + diff --git a/edit/logging.banzaicloud.io.output/providers/azurestorage.vue b/edit/logging.banzaicloud.io.output/providers/azurestorage.vue new file mode 100644 index 0000000000..20b1e14cff --- /dev/null +++ b/edit/logging.banzaicloud.io.output/providers/azurestorage.vue @@ -0,0 +1,73 @@ + + + diff --git a/edit/logging.banzaicloud.io.output/providers/cloudwatch.vue b/edit/logging.banzaicloud.io.output/providers/cloudwatch.vue new file mode 100644 index 0000000000..e2c3e11375 --- /dev/null +++ b/edit/logging.banzaicloud.io.output/providers/cloudwatch.vue @@ -0,0 +1,68 @@ + + + diff --git a/edit/logging.banzaicloud.io.output/providers/datadog.vue b/edit/logging.banzaicloud.io.output/providers/datadog.vue new file mode 100644 index 0000000000..77e03bdfbb --- /dev/null +++ b/edit/logging.banzaicloud.io.output/providers/datadog.vue @@ -0,0 +1,75 @@ + + + diff --git a/edit/logging.banzaicloud.io.output/providers/file.vue b/edit/logging.banzaicloud.io.output/providers/file.vue new file mode 100644 index 0000000000..0018a97ddc --- /dev/null +++ b/edit/logging.banzaicloud.io.output/providers/file.vue @@ -0,0 +1,38 @@ + + + diff --git a/edit/logging.banzaicloud.io.output/providers/forward.vue b/edit/logging.banzaicloud.io.output/providers/forward.vue index 51e9bb4cfe..7e73bc8781 100644 --- a/edit/logging.banzaicloud.io.output/providers/forward.vue +++ b/edit/logging.banzaicloud.io.output/providers/forward.vue @@ -85,5 +85,42 @@ export default { />
+
+
+
+

{{ t('logging.output.sections.certificate') }}

+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
diff --git a/edit/logging.banzaicloud.io.output/providers/gcs.vue b/edit/logging.banzaicloud.io.output/providers/gcs.vue new file mode 100644 index 0000000000..c2367f0fbd --- /dev/null +++ b/edit/logging.banzaicloud.io.output/providers/gcs.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/edit/logging.banzaicloud.io.output/providers/kinesisStream.vue b/edit/logging.banzaicloud.io.output/providers/kinesisStream.vue new file mode 100644 index 0000000000..213040ae7c --- /dev/null +++ b/edit/logging.banzaicloud.io.output/providers/kinesisStream.vue @@ -0,0 +1,65 @@ + + + diff --git a/edit/logging.banzaicloud.io.output/providers/logdna.vue b/edit/logging.banzaicloud.io.output/providers/logdna.vue new file mode 100644 index 0000000000..b5ca4fab4b --- /dev/null +++ b/edit/logging.banzaicloud.io.output/providers/logdna.vue @@ -0,0 +1,52 @@ + + + diff --git a/edit/logging.banzaicloud.io.output/providers/logz.vue b/edit/logging.banzaicloud.io.output/providers/logz.vue new file mode 100644 index 0000000000..c9c6398ca5 --- /dev/null +++ b/edit/logging.banzaicloud.io.output/providers/logz.vue @@ -0,0 +1,88 @@ + + + diff --git a/edit/logging.banzaicloud.io.output/providers/loki.vue b/edit/logging.banzaicloud.io.output/providers/loki.vue index b61e34483d..831a688315 100644 --- a/edit/logging.banzaicloud.io.output/providers/loki.vue +++ b/edit/logging.banzaicloud.io.output/providers/loki.vue @@ -71,6 +71,43 @@ export default {
+
+
+

{{ t('logging.output.sections.certificate') }}

+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+

{{ t('logging.output.sections.labels') }}

diff --git a/edit/logging.banzaicloud.io.output/providers/newrelic.vue b/edit/logging.banzaicloud.io.output/providers/newrelic.vue new file mode 100644 index 0000000000..9fcdc7f063 --- /dev/null +++ b/edit/logging.banzaicloud.io.output/providers/newrelic.vue @@ -0,0 +1,65 @@ + + + diff --git a/edit/logging.banzaicloud.io.output/providers/s3.vue b/edit/logging.banzaicloud.io.output/providers/s3.vue new file mode 100644 index 0000000000..e49cfa2294 --- /dev/null +++ b/edit/logging.banzaicloud.io.output/providers/s3.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/edit/logging.banzaicloud.io.output/providers/splunkHec.vue b/edit/logging.banzaicloud.io.output/providers/splunkHec.vue index 430efbc824..aefa4d2bd1 100644 --- a/edit/logging.banzaicloud.io.output/providers/splunkHec.vue +++ b/edit/logging.banzaicloud.io.output/providers/splunkHec.vue @@ -89,5 +89,45 @@ export default {
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
diff --git a/edit/logging.banzaicloud.io.output/providers/sumologic.vue b/edit/logging.banzaicloud.io.output/providers/sumologic.vue new file mode 100644 index 0000000000..a5bc662d23 --- /dev/null +++ b/edit/logging.banzaicloud.io.output/providers/sumologic.vue @@ -0,0 +1,56 @@ + + + diff --git a/models/logging.banzaicloud.io.output.js b/models/logging.banzaicloud.io.output.js index e4e9423e2e..fa3de584bd 100644 --- a/models/logging.banzaicloud.io.output.js +++ b/models/logging.banzaicloud.io.output.js @@ -1,34 +1,89 @@ export const PROVIDERS = [ + { + name: 'awsElasticsearch', + labelKey: 'logging.outputProviders.awsElasticsearch', + default: { endpoint: {} }, + }, + { + name: 'azurestorage', + labelKey: 'logging.outputProviders.azurestorage', + default: { }, + }, + { + name: 'cloudwatch', + labelKey: 'logging.outputProviders.cloudwatch', + default: { }, + }, + { + name: 'datadog', + labelKey: 'logging.outputProviders.datadog', + default: { }, + }, { name: 'elasticsearch', labelKey: 'logging.outputProviders.elasticsearch', - enabled: false, default: {}, }, { - name: 'splunkHec', - labelKey: 'logging.outputProviders.splunkHec', - enabled: false, - default: {}, - }, - { - name: 'kafka', - labelKey: 'logging.outputProviders.kafka', - enabled: false, - default: { format: { type: 'json' } }, + name: 'file', + labelKey: 'logging.outputProviders.file', + default: { }, }, { name: 'forward', labelKey: 'logging.outputProviders.forward', - enabled: false, default: { servers: [{}] }, }, + { + name: 'gcs', + labelKey: 'logging.outputProviders.gcs', + default: { }, + }, + { + name: 'kafka', + labelKey: 'logging.outputProviders.kafka', + default: { format: { type: 'json' } }, + }, + { + name: 'kinesisStream', + labelKey: 'logging.outputProviders.kinesisStream', + default: { }, + }, + { + name: 'logdna', + labelKey: 'logging.outputProviders.logdna', + default: { }, + }, + { + name: 'logz', + labelKey: 'logging.outputProviders.logz', + default: { endpoint: {} }, + }, { name: 'loki', labelKey: 'logging.outputProviders.loki', - enabled: false, default: { configure_kubernetes_labels: true }, - } + }, + { + name: 'newrelic', + labelKey: 'logging.outputProviders.newrelic', + default: { }, + }, + { + name: 'splunkHec', + labelKey: 'logging.outputProviders.splunkHec', + default: {}, + }, + { + name: 'sumologic', + labelKey: 'logging.outputProviders.sumologic', + default: { }, + }, + { + name: 's3', + labelKey: 'logging.outputProviders.s3', + default: { }, + }, ]; export default {