├── .dockerignore ├── .fossa.yml ├── .github ├── .editorconfig ├── ISSUE_TEMPLATE │ ├── ---bug-report.md │ └── --feature-request.md ├── archive │ └── trigger-submodule-update.yaml ├── release.yml ├── stale.yml └── workflows │ ├── artifacts.yaml │ ├── ci.yaml │ ├── config-reloader.yaml │ ├── dependency-images.yaml │ ├── e2e.yaml │ ├── fluentd-drain-watch.yaml │ ├── fluentd-images.yaml │ ├── node-exporter.yaml │ ├── release.yaml │ └── syslog-ng-reloader.yaml ├── .gitignore ├── .go-version ├── .golangci.yml ├── .idea ├── copyright │ ├── Kube_Logging_authors.xml │ └── profiles_settings.xml ├── logging-operator.iml ├── modules.xml └── vcs.xml ├── .licensei.toml ├── .testcoverage.yml ├── .tool-versions ├── ADOPTERS.md ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── MAINTAINERS.md ├── Makefile ├── NOTICE ├── PROJECT ├── README.md ├── charts-docs ├── README.md └── templates │ ├── README.md.gotmpl │ └── overrides.gotmpl ├── charts ├── logging-demo │ └── README.md └── logging-operator │ ├── .helmignore │ ├── Chart.lock │ ├── Chart.yaml │ ├── README.md │ ├── README.md.gotmpl │ ├── charts │ └── logging-operator-crds │ │ ├── Chart.yaml │ │ ├── README.md │ │ ├── templates │ │ ├── logging-extensions.banzaicloud.io_eventtailers.yaml │ │ ├── logging-extensions.banzaicloud.io_hosttailers.yaml │ │ ├── logging.banzaicloud.io_axosyslogs.yaml │ │ ├── logging.banzaicloud.io_clusterflows.yaml │ │ ├── logging.banzaicloud.io_clusteroutputs.yaml │ │ ├── logging.banzaicloud.io_flows.yaml │ │ ├── logging.banzaicloud.io_fluentbitagents.yaml │ │ ├── logging.banzaicloud.io_fluentdconfigs.yaml │ │ ├── logging.banzaicloud.io_loggingroutes.yaml │ │ ├── logging.banzaicloud.io_loggings.yaml │ │ ├── logging.banzaicloud.io_nodeagents.yaml │ │ ├── logging.banzaicloud.io_outputs.yaml │ │ ├── logging.banzaicloud.io_syslogngclusterflows.yaml │ │ ├── logging.banzaicloud.io_syslogngclusteroutputs.yaml │ │ ├── logging.banzaicloud.io_syslogngconfigs.yaml │ │ ├── logging.banzaicloud.io_syslogngflows.yaml │ │ └── logging.banzaicloud.io_syslogngoutputs.yaml │ │ └── values.yaml │ ├── crds │ ├── logging-extensions.banzaicloud.io_eventtailers.yaml │ ├── logging-extensions.banzaicloud.io_hosttailers.yaml │ ├── logging.banzaicloud.io_axosyslogs.yaml │ ├── logging.banzaicloud.io_clusterflows.yaml │ ├── logging.banzaicloud.io_clusteroutputs.yaml │ ├── logging.banzaicloud.io_flows.yaml │ ├── logging.banzaicloud.io_fluentbitagents.yaml │ ├── logging.banzaicloud.io_fluentdconfigs.yaml │ ├── logging.banzaicloud.io_loggingroutes.yaml │ ├── logging.banzaicloud.io_loggings.yaml │ ├── logging.banzaicloud.io_nodeagents.yaml │ ├── logging.banzaicloud.io_outputs.yaml │ ├── logging.banzaicloud.io_syslogngclusterflows.yaml │ ├── logging.banzaicloud.io_syslogngclusteroutputs.yaml │ ├── logging.banzaicloud.io_syslogngconfigs.yaml │ ├── logging.banzaicloud.io_syslogngflows.yaml │ └── logging.banzaicloud.io_syslogngoutputs.yaml │ ├── templates │ ├── NOTES.txt │ ├── _helpers.tpl │ ├── clusterrole.yaml │ ├── clusterrolebinding.yaml │ ├── crds.yaml │ ├── deployment.yaml │ ├── extra-manifests.yaml │ ├── logging │ │ ├── clusterflows.yaml │ │ ├── clusteroutputs.yaml │ │ ├── eventtailer.yaml │ │ ├── fluentbit.yaml │ │ ├── hosttailer.yaml │ │ ├── hosttailers.yaml │ │ └── logging.yaml │ ├── service.yaml │ ├── service_monitor.yaml │ ├── serviceaccount.yaml │ ├── test_receiver.yaml │ └── userrole.yaml │ ├── values-logging-example.yaml │ └── values.yaml ├── cmd └── docs.go ├── config ├── certmanager │ ├── certificate.yaml │ ├── kustomization.yaml │ └── kustomizeconfig.yaml ├── crd │ ├── bases │ │ ├── logging-extensions.banzaicloud.io_eventtailers.yaml │ │ ├── logging-extensions.banzaicloud.io_hosttailers.yaml │ │ ├── logging.banzaicloud.io_axosyslogs.yaml │ │ ├── logging.banzaicloud.io_clusterflows.yaml │ │ ├── logging.banzaicloud.io_clusteroutputs.yaml │ │ ├── logging.banzaicloud.io_flows.yaml │ │ ├── logging.banzaicloud.io_fluentbitagents.yaml │ │ ├── logging.banzaicloud.io_fluentdconfigs.yaml │ │ ├── logging.banzaicloud.io_loggingroutes.yaml │ │ ├── logging.banzaicloud.io_loggings.yaml │ │ ├── logging.banzaicloud.io_nodeagents.yaml │ │ ├── logging.banzaicloud.io_outputs.yaml │ │ ├── logging.banzaicloud.io_syslogngclusterflows.yaml │ │ ├── logging.banzaicloud.io_syslogngclusteroutputs.yaml │ │ ├── logging.banzaicloud.io_syslogngconfigs.yaml │ │ ├── logging.banzaicloud.io_syslogngflows.yaml │ │ └── logging.banzaicloud.io_syslogngoutputs.yaml │ ├── kustomization.yaml │ ├── kustomizeconfig.yaml │ └── patches │ │ ├── cainjection_in_clusterflows.yaml │ │ ├── cainjection_in_clusteroutputs.yaml │ │ ├── cainjection_in_flows.yaml │ │ ├── cainjection_in_fluentbits.yaml │ │ ├── cainjection_in_fluentds.yaml │ │ ├── cainjection_in_loggings.yaml │ │ ├── cainjection_in_outputs.yaml │ │ ├── webhook_in_clusterflows.yaml │ │ ├── webhook_in_clusteroutputs.yaml │ │ ├── webhook_in_flows.yaml │ │ ├── webhook_in_fluentbits.yaml │ │ ├── webhook_in_fluentds.yaml │ │ ├── webhook_in_loggings.yaml │ │ └── webhook_in_outputs.yaml ├── dashboards │ └── logging-dashboard.json ├── default │ ├── kustomization.yaml │ ├── manager_auth_proxy_patch.yaml │ ├── manager_image_patch.yaml │ ├── manager_image_patch.yaml-e │ ├── manager_prometheus_metrics_patch.yaml │ ├── manager_webhook_patch.yaml │ └── webhookcainjection_patch.yaml ├── manager │ ├── kustomization.yaml │ └── manager.yaml ├── rbac │ ├── auth_proxy_role.yaml │ ├── auth_proxy_role_binding.yaml │ ├── auth_proxy_service.yaml │ ├── kustomization.yaml │ ├── leader_election_role.yaml │ ├── leader_election_role_binding.yaml │ ├── role.yaml │ └── role_binding.yaml ├── samples │ ├── all-to-file.yaml │ ├── all-to-stdout-nslabel.yaml │ ├── all-to-stdout.yaml │ ├── archive │ │ ├── logging_v1alpha2_cluster_output_custom.yaml │ │ ├── logging_v1alpha2_flow.yaml │ │ ├── logging_v1alpha2_flow_custom.yaml │ │ ├── logging_v1alpha2_logging_custom.yaml │ │ ├── logging_v1alpha2_logging_debug.yaml │ │ ├── logging_v1alpha2_logging_default.yaml │ │ ├── logging_v1alpha2_logging_disablelogrotate.yaml │ │ ├── logging_v1alpha2_logging_labels.yaml │ │ ├── logging_v1alpha2_logging_psp.yaml │ │ ├── logging_v1alpha2_logging_pvc.yaml │ │ ├── logging_v1alpha2_logging_tailer.yaml │ │ ├── logging_v1alpha2_multiflow.yaml │ │ ├── logging_v1alpha2_nodeagent.yaml │ │ ├── logging_v1alpha2_nodeagent_loggingref.yaml │ │ ├── logging_v1alpha2_output.yaml │ │ └── logging_v1alpha2_output_custom.yaml │ ├── configcheck-timeout-syslog-ng.yaml │ ├── configcheck-timeout.yaml │ ├── containerd-log.yaml │ ├── containerd-merge-log.yaml │ ├── extensions │ │ ├── logging-extensions_v1alpha1_eventtailer_with_pvc.yaml │ │ ├── logging-extensions_v1alpha1_eventtailer_without_pvc.yaml │ │ ├── logging-extensions_v1alpha1_hosttailer.yaml │ │ ├── logging-extensions_v1alpha1_webhook.yaml │ │ ├── testpod.yaml │ │ ├── testpod_annotated.yaml │ │ └── testpod_annotated_multicontainer.yaml │ ├── fluentbit-multi.yaml │ ├── fluentd-extravolumes.yaml │ ├── fluentdconfig.yaml │ ├── logging_logging_fluentd_sidecars.yaml │ ├── logging_logging_watchNamespaceSelector.yaml │ ├── logging_logging_with_monitoring.yaml │ ├── mulitenant-hard │ │ ├── README.md │ │ └── logging │ │ │ ├── receiver-infra.yaml │ │ │ ├── tenant-a-logging.yaml │ │ │ ├── tenant-a-user.yaml │ │ │ ├── tenant-b-logging.yaml │ │ │ └── tenant-b-user.yaml │ ├── multitenant-routing-2 │ │ ├── README.md │ │ └── logging │ │ │ ├── tenant-a-logging.yaml │ │ │ ├── tenant-a-user.yaml │ │ │ ├── tenant-b-logging.yaml │ │ │ ├── tenant-b-user1.yaml │ │ │ ├── tenant-b-user2.yaml │ │ │ ├── tenant-c-logging.yaml │ │ │ ├── tenant-c-user.yaml │ │ │ ├── tenant-infra-logging.yaml │ │ │ └── tenant-infra-receiver.yaml │ ├── multitenant-routing-tc │ │ └── tc-simple │ │ │ ├── README.md │ │ │ ├── collector.yaml │ │ │ ├── tenant-a.yaml │ │ │ ├── tenant-b.yaml │ │ │ └── tenant-infra.yaml │ ├── multitenant-routing │ │ ├── README.md │ │ └── logging │ │ │ ├── tenant-a-logging.yaml │ │ │ ├── tenant-b-logging.yaml │ │ │ ├── tenant-infra-logging.yaml │ │ │ └── tenant-infra-receiver.yaml │ ├── syslog-ng-custom-metrics.yaml │ ├── syslog-ng-otlp │ │ ├── manifests.yaml │ │ └── opentelemetry.yaml │ ├── syslog-ng-pvc-metrics.yaml │ ├── syslog-ng-retry.yaml │ ├── syslog-ng-simple.yaml │ └── telemetry-controller-routing │ │ ├── README.md │ │ ├── tc-tenant-a-logging.yaml │ │ ├── tc-tenant-b-logging.yaml │ │ ├── tc-tenant-infra-logging.yaml │ │ └── tc-tenant-infra-receiver.yaml └── webhook │ ├── kustomization.yaml │ ├── kustomizeconfig.yaml │ └── service.yaml ├── controllers ├── extensions │ ├── eventtailer_controller.go │ ├── hosttailer_controller.go │ └── suite_test.go └── logging │ ├── axosyslog_controller.go │ ├── logging_controller.go │ ├── logging_controller_match_test.go │ ├── logging_controller_test.go │ ├── loggingroute_controller.go │ ├── suite_test.go │ ├── telemetry_controller_controller.go │ └── tenant_test.go ├── docs ├── README.md ├── configuration │ ├── crds │ │ ├── extensions │ │ │ └── v1alpha1 │ │ │ │ ├── eventtailer_types.md │ │ │ │ ├── filetailer.md │ │ │ │ ├── hosttailer_types.md │ │ │ │ └── systemdtailer.md │ │ └── v1beta1 │ │ │ ├── _index.md │ │ │ ├── axosyslog_types.md │ │ │ ├── clusterflow_types.md │ │ │ ├── clusteroutput_types.md │ │ │ ├── common_types.md │ │ │ ├── conversion.md │ │ │ ├── flow_types.md │ │ │ ├── fluentbit_types.md │ │ │ ├── fluentd_config_types.md │ │ │ ├── fluentd_types.md │ │ │ ├── logging_types.md │ │ │ ├── loggingroute_types.md │ │ │ ├── node_agent_types.md │ │ │ ├── output_types.md │ │ │ ├── syslogng_clusterflow_types.md │ │ │ ├── syslogng_clusteroutput_types.md │ │ │ ├── syslogng_config_types.md │ │ │ ├── syslogng_flow_types.md │ │ │ ├── syslogng_output_types.md │ │ │ └── syslogng_types.md │ └── plugins │ │ ├── _index.md │ │ ├── common │ │ ├── security.md │ │ └── transport.md │ │ ├── filters │ │ ├── concat.md │ │ ├── dedot.md │ │ ├── detect_exceptions.md │ │ ├── elasticsearch_genid.md │ │ ├── enhance_k8s.md │ │ ├── geoip.md │ │ ├── grep.md │ │ ├── kube_events_timestamp.md │ │ ├── parser.md │ │ ├── prometheus.md │ │ ├── record_modifier.md │ │ ├── record_transformer.md │ │ ├── stdout.md │ │ ├── sumologic.md │ │ ├── tagnormaliser.md │ │ ├── throttle.md │ │ └── useragent.md │ │ ├── outputs │ │ ├── aws_elasticsearch.md │ │ ├── azurestore.md │ │ ├── buffer.md │ │ ├── cloudwatch.md │ │ ├── datadog.md │ │ ├── elasticsearch.md │ │ ├── file.md │ │ ├── format.md │ │ ├── format_rfc5424.md │ │ ├── forward.md │ │ ├── gcs.md │ │ ├── gelf.md │ │ ├── http.md │ │ ├── kafka.md │ │ ├── kinesis_firehose.md │ │ ├── kinesis_stream.md │ │ ├── logdna.md │ │ ├── logz.md │ │ ├── loki.md │ │ ├── mattermost.md │ │ ├── newrelic.md │ │ ├── null.md │ │ ├── opensearch.md │ │ ├── oss.md │ │ ├── redis.md │ │ ├── relabel.md │ │ ├── s3.md │ │ ├── splunk_hec.md │ │ ├── sqs.md │ │ ├── sumologic.md │ │ ├── syslog.md │ │ ├── vmware_log_intelligence.md │ │ └── vmware_loginsight.md │ │ ├── syslogng-filters │ │ ├── match.md │ │ ├── parser.md │ │ └── rewrite.md │ │ ├── syslogng-outputs │ │ ├── auth.md │ │ ├── disk_buffer.md │ │ ├── elasticsearch.md │ │ ├── elasticsearch_datastream.md │ │ ├── file.md │ │ ├── http.md │ │ ├── loggly.md │ │ ├── logscale.md │ │ ├── loki.md │ │ ├── mongodb.md │ │ ├── mqtt.md │ │ ├── openobserve.md │ │ ├── opentelemetry.md │ │ ├── redis.md │ │ ├── s3.md │ │ ├── splunk_hec.md │ │ ├── sumologic_http.md │ │ ├── sumologic_syslog.md │ │ ├── syslog.md │ │ └── tls.md │ │ └── syslogng │ │ ├── filters │ │ ├── match.md │ │ ├── parser.md │ │ └── rewrite.md │ │ └── outputs │ │ ├── disk_buffer.md │ │ ├── file.md │ │ ├── loggly.md │ │ ├── sumologic_http.md │ │ ├── sumologic_syslog.md │ │ ├── syslog.md │ │ └── tls.md ├── fluentbit-config-reload.md ├── fluentbit-flow-control.md ├── logging-route.md ├── multi-tenancy.md ├── multi-worker.md ├── scaling.md ├── sniffing-trafic.md ├── standalone-aggregator-config.md ├── syslog-ng-date-parser.md ├── syslogng-quickstart.md ├── terraform-syslog-ng-s3.md └── volume-drainer.md ├── e2e ├── common │ ├── cluster.go │ ├── cond │ │ └── conditions.go │ ├── helpers.go │ ├── kind.go │ ├── kind │ │ └── commands.go │ ├── panicobject.go │ ├── resources.go │ └── setup │ │ ├── loggingoperator.go │ │ ├── logproducer.go │ │ └── restclientgetter.go ├── fluentbit-hotreload │ └── fluentbit_hotreload_test.go ├── fluentbit-multitenant │ └── fluentbit_multitenant_test.go ├── fluentd-aggregator-detached-multiple-failures │ └── fluentd_aggregator_detached_multiple_failures_test.go ├── fluentd-aggregator-detached │ └── fluentd_aggregator_detached_test.go ├── fluentd-aggregator-namespacelabel │ └── fluentd_aggregator_test.go ├── fluentd-aggregator │ └── fluentd_aggregator_test.go ├── go.mod ├── go.sum ├── logging_metrics_monitoring │ └── logging_metrics_monitoring_test.go ├── syslog-ng-aggregator-detached │ └── syslog_ng_aggregator_detached_test.go ├── syslog-ng-aggregator │ └── syslog_ng_aggregator_test.go ├── volumedrain │ └── volumedrain_test.go └── watch-selector │ └── watch_selector_test.go ├── fluent-bit-image └── v1.6 │ └── Dockerfile.windows ├── go.mod ├── go.sum ├── go.work ├── hack ├── boilerplate.go.txt ├── crds.annotations.snippet.txt ├── test.sh └── values.yaml ├── images ├── config-reloader │ ├── Dockerfile │ ├── README.md │ ├── cmd │ │ └── configreloader │ │ │ └── main.go │ ├── go.mod │ ├── go.sum │ └── pkg │ │ ├── configreloader │ │ ├── configreloader.go │ │ └── types.go │ │ └── metrics │ │ └── metrics.go ├── fluentd-drain-watch │ ├── Dockerfile │ ├── README.md │ └── drain-watch.sh ├── fluentd │ ├── Dockerfile │ ├── README.md │ ├── entrypoint.sh │ ├── filters │ │ ├── Gemfile │ │ └── Gemfile.lock │ ├── fluent.conf │ ├── healthy.sh │ └── outputs │ │ ├── Gemfile │ │ └── Gemfile.lock ├── node-exporter │ ├── Dockerfile │ ├── README.md │ └── buffer-size.sh └── syslog-ng-reloader │ ├── Dockerfile │ └── README.md ├── main.go ├── pkg ├── compression │ └── compression.go ├── mirror │ └── struct_iter.go ├── resources │ ├── annotation │ │ ├── annotation.go │ │ └── annotation_test.go │ ├── configcheck │ │ └── configcheck.go │ ├── eventtailer │ │ ├── clusterrole.go │ │ ├── clusterrolebinding.go │ │ ├── configmap.go │ │ ├── eventtailer.go │ │ ├── helpers.go │ │ ├── serviceaccount.go │ │ └── statefulset.go │ ├── features.go │ ├── fluentbit │ │ ├── buffervolumeprometheusrules.go │ │ ├── config.go │ │ ├── configsecret.go │ │ ├── configsecret_test.go │ │ ├── daemonset.go │ │ ├── fluentbit.go │ │ ├── meta.go │ │ ├── prometheusrules.go │ │ ├── rbac.go │ │ ├── service.go │ │ └── tenants.go │ ├── fluentd │ │ ├── appconfigmap.go │ │ ├── buffervolumeprometheusrules.go │ │ ├── component.go │ │ ├── config.go │ │ ├── configsecret.go │ │ ├── dataprovider.go │ │ ├── drainjob.go │ │ ├── fluentd.go │ │ ├── meta.go │ │ ├── outputsecret.go │ │ ├── pdb.go │ │ ├── placeholderpod.go │ │ ├── prometheusrules.go │ │ ├── rbac.go │ │ ├── service.go │ │ └── statefulset.go │ ├── hosttailer │ │ ├── helpers.go │ │ └── hosttailer.go │ ├── kubetool │ │ ├── utils.go │ │ ├── utils_test.go │ │ ├── volumebuilder.go │ │ ├── volumebuilder_test.go │ │ ├── volumemountbuilder.go │ │ └── volumemountbuilder_test.go │ ├── loggingdataprovider │ │ └── interface.go │ ├── model │ │ ├── reconciler.go │ │ ├── reconciler_test.go │ │ ├── repository.go │ │ ├── resources.go │ │ └── system.go │ ├── nodeagent │ │ ├── config.go │ │ ├── configsecret.go │ │ ├── daemonset.go │ │ ├── meta.go │ │ ├── nodeagent.go │ │ ├── rbac.go │ │ └── service.go │ ├── prometheus-operator │ │ └── helper.go │ ├── reconciler.go │ ├── syslogng │ │ ├── buffervolumeprometheusrules.go │ │ ├── component.go │ │ ├── configcheck.go │ │ ├── configsecret.go │ │ ├── dataprovider.go │ │ ├── meta.go │ │ ├── outputsecret.go │ │ ├── prometheusrules.go │ │ ├── rbac.go │ │ ├── service.go │ │ ├── statefulset.go │ │ └── syslogng.go │ ├── telemetry-controller │ │ └── resources.go │ ├── templates │ │ └── templates.go │ └── volumepath │ │ ├── volumepath.go │ │ └── volumepath_test.go ├── sdk │ ├── extensions │ │ ├── api │ │ │ ├── tailer │ │ │ │ ├── tailer.go │ │ │ │ └── zz_generated.deepcopy.go │ │ │ └── v1alpha1 │ │ │ │ ├── eventtailer_types.go │ │ │ │ ├── filetailer.go │ │ │ │ ├── groupversion_info.go │ │ │ │ ├── hosttailer_types.go │ │ │ │ ├── systemdtailer.go │ │ │ │ └── zz_generated.deepcopy.go │ │ └── extensionsconfig │ │ │ ├── config.go │ │ │ └── config_test.go │ ├── go.mod │ ├── go.sum │ ├── logging │ │ ├── api │ │ │ ├── v1alpha1 │ │ │ │ ├── clusterflow_conversion.go │ │ │ │ ├── clusterflow_types.go │ │ │ │ ├── clusteroutput_conversion.go │ │ │ │ ├── clusteroutput_types.go │ │ │ │ ├── conversion.go │ │ │ │ ├── flow_conversion.go │ │ │ │ ├── flow_types.go │ │ │ │ ├── groupversion_info.go │ │ │ │ ├── logging_conversion.go │ │ │ │ ├── logging_types.go │ │ │ │ ├── output_conversion.go │ │ │ │ ├── output_types.go │ │ │ │ └── zz_generated.deepcopy.go │ │ │ └── v1beta1 │ │ │ │ ├── axosyslog_types.go │ │ │ │ ├── clusterflow_types.go │ │ │ │ ├── clusterflow_types_test.go │ │ │ │ ├── clusteroutput_types.go │ │ │ │ ├── clusteroutput_types_test.go │ │ │ │ ├── common_types.go │ │ │ │ ├── common_types_test.go │ │ │ │ ├── conversion.go │ │ │ │ ├── flow_types.go │ │ │ │ ├── flow_types_test.go │ │ │ │ ├── fluentbit_types.go │ │ │ │ ├── fluentd_config_types.go │ │ │ │ ├── fluentd_types.go │ │ │ │ ├── groupversion_info.go │ │ │ │ ├── logging_types.go │ │ │ │ ├── loggingroute_types.go │ │ │ │ ├── node_agent_types.go │ │ │ │ ├── output_types.go │ │ │ │ ├── output_types_test.go │ │ │ │ ├── suite_test.go │ │ │ │ ├── syslogng_clusterflow_types.go │ │ │ │ ├── syslogng_clusteroutput_types.go │ │ │ │ ├── syslogng_config_types.go │ │ │ │ ├── syslogng_flow_types.go │ │ │ │ ├── syslogng_output_types.go │ │ │ │ ├── syslogng_types.go │ │ │ │ └── zz_generated.deepcopy.go │ │ ├── maps │ │ │ └── mapstrstr │ │ │ │ └── helpers.go │ │ ├── model │ │ │ ├── common │ │ │ │ ├── security.go │ │ │ │ └── transport.go │ │ │ ├── filter │ │ │ │ ├── concat.go │ │ │ │ ├── concat_test.go │ │ │ │ ├── dedot.go │ │ │ │ ├── dedot_test.go │ │ │ │ ├── detect_exceptions.go │ │ │ │ ├── detect_exceptions_test.go │ │ │ │ ├── elasticsearch_genid.go │ │ │ │ ├── elasticsearch_genid_test.go │ │ │ │ ├── geoip.go │ │ │ │ ├── geoip_test.go │ │ │ │ ├── grep.go │ │ │ │ ├── grep_test.go │ │ │ │ ├── kube_events_timestamp.go │ │ │ │ ├── kube_events_timestamp_test.go │ │ │ │ ├── parser.go │ │ │ │ ├── parser_test.go │ │ │ │ ├── prometheus.go │ │ │ │ ├── prometheus_test.go │ │ │ │ ├── record_modifier.go │ │ │ │ ├── record_modifier_test.go │ │ │ │ ├── record_transformer.go │ │ │ │ ├── record_transformer_test.go │ │ │ │ ├── stdout.go │ │ │ │ ├── stdout_test.go │ │ │ │ ├── tagnormaliser.go │ │ │ │ ├── tagnormaliser_test.go │ │ │ │ ├── throttle.go │ │ │ │ ├── throttle_test.go │ │ │ │ ├── useragent.go │ │ │ │ ├── useragent_test.go │ │ │ │ └── zz_generated.deepcopy.go │ │ │ ├── input │ │ │ │ ├── forward.go │ │ │ │ ├── tail.go │ │ │ │ └── zz_generated.deepcopy.go │ │ │ ├── output │ │ │ │ ├── aws_elasticsearch.go │ │ │ │ ├── aws_elasticsearch_test.go │ │ │ │ ├── azurestore.go │ │ │ │ ├── azurestore_test.go │ │ │ │ ├── buffer.go │ │ │ │ ├── cloudwatch.go │ │ │ │ ├── cloudwatch_test.go │ │ │ │ ├── datadog.go │ │ │ │ ├── datadog_test.go │ │ │ │ ├── elasticsearch.go │ │ │ │ ├── elasticsearch_test.go │ │ │ │ ├── file.go │ │ │ │ ├── file_test.go │ │ │ │ ├── format.go │ │ │ │ ├── format_rfc5424.go │ │ │ │ ├── format_test.go │ │ │ │ ├── forward.go │ │ │ │ ├── forward_test.go │ │ │ │ ├── gcs.go │ │ │ │ ├── gcs_test.go │ │ │ │ ├── gelf.go │ │ │ │ ├── gelf_test.go │ │ │ │ ├── http.go │ │ │ │ ├── http_test.go │ │ │ │ ├── kafka.go │ │ │ │ ├── kafka_test.go │ │ │ │ ├── kinesis_firehose.go │ │ │ │ ├── kinesis_firehose_test.go │ │ │ │ ├── kinesis_stream.go │ │ │ │ ├── kinesis_stream_test.go │ │ │ │ ├── logdna.go │ │ │ │ ├── logdna_test.go │ │ │ │ ├── logz.go │ │ │ │ ├── logz_test.go │ │ │ │ ├── loki.go │ │ │ │ ├── loki_test.go │ │ │ │ ├── mattermost.go │ │ │ │ ├── mattermost_test.go │ │ │ │ ├── newrelic.go │ │ │ │ ├── newrelic_test.go │ │ │ │ ├── null.go │ │ │ │ ├── null_test.go │ │ │ │ ├── opensearch.go │ │ │ │ ├── opensearch_test.go │ │ │ │ ├── oss.go │ │ │ │ ├── oss_test.go │ │ │ │ ├── redis.go │ │ │ │ ├── redis_test.go │ │ │ │ ├── relabel.go │ │ │ │ ├── relabel_test.go │ │ │ │ ├── s3.go │ │ │ │ ├── s3_test.go │ │ │ │ ├── splunk_hec.go │ │ │ │ ├── splunk_hec_test.go │ │ │ │ ├── sqs.go │ │ │ │ ├── sqs_test.go │ │ │ │ ├── syslog.go │ │ │ │ ├── syslog_test.go │ │ │ │ ├── vmware_log_intelligence.go │ │ │ │ ├── vmware_log_intelligence_test.go │ │ │ │ ├── vmware_loginsight.go │ │ │ │ ├── vmware_loginsight_test.go │ │ │ │ └── zz_generated.deepcopy.go │ │ │ ├── render │ │ │ │ ├── fluent.go │ │ │ │ ├── fluent_test.go │ │ │ │ ├── interface.go │ │ │ │ └── test_helper.go │ │ │ ├── syslogng │ │ │ │ ├── config │ │ │ │ │ ├── channel.go │ │ │ │ │ ├── common.go │ │ │ │ │ ├── config.go │ │ │ │ │ ├── config_test.go │ │ │ │ │ ├── destination.go │ │ │ │ │ ├── field.go │ │ │ │ │ ├── filter.go │ │ │ │ │ ├── filter_test.go │ │ │ │ │ ├── flow.go │ │ │ │ │ ├── flow_test.go │ │ │ │ │ ├── go.mod │ │ │ │ │ ├── go.sum │ │ │ │ │ ├── log.go │ │ │ │ │ ├── model │ │ │ │ │ │ └── filter.go │ │ │ │ │ ├── output.go │ │ │ │ │ ├── output_tests │ │ │ │ │ │ ├── elasticsearch_datastream_test.go │ │ │ │ │ │ ├── elasticsearch_test.go │ │ │ │ │ │ ├── http_test.go │ │ │ │ │ │ ├── loggly_test.go │ │ │ │ │ │ ├── loki_test.go │ │ │ │ │ │ ├── mongodb_test.go │ │ │ │ │ │ ├── openobserve_test.go │ │ │ │ │ │ ├── otlp_test.go │ │ │ │ │ │ ├── redis_test.go │ │ │ │ │ │ ├── s3_test.go │ │ │ │ │ │ └── splunk_hec_test.go │ │ │ │ │ ├── parser.go │ │ │ │ │ ├── render │ │ │ │ │ │ ├── helpers.go │ │ │ │ │ │ └── render_test.go │ │ │ │ │ ├── rewrite.go │ │ │ │ │ ├── source.go │ │ │ │ │ ├── syntax.go │ │ │ │ │ ├── tag.go │ │ │ │ │ └── test_helpers.go │ │ │ │ ├── filter │ │ │ │ │ ├── match.go │ │ │ │ │ ├── parser.go │ │ │ │ │ ├── rewrite.go │ │ │ │ │ └── zz_generated.deepcopy.go │ │ │ │ └── output │ │ │ │ │ ├── auth.go │ │ │ │ │ ├── disk_buffer.go │ │ │ │ │ ├── elasticsearch.go │ │ │ │ │ ├── elasticsearch_datastream.go │ │ │ │ │ ├── file.go │ │ │ │ │ ├── http.go │ │ │ │ │ ├── loggly.go │ │ │ │ │ ├── logscale.go │ │ │ │ │ ├── loki.go │ │ │ │ │ ├── mongodb.go │ │ │ │ │ ├── mqtt.go │ │ │ │ │ ├── openobserve.go │ │ │ │ │ ├── opentelemetry.go │ │ │ │ │ ├── redis.go │ │ │ │ │ ├── s3.go │ │ │ │ │ ├── splunk_hec.go │ │ │ │ │ ├── sumologic_http.go │ │ │ │ │ ├── sumologic_syslog.go │ │ │ │ │ ├── syslog.go │ │ │ │ │ ├── tls.go │ │ │ │ │ └── zz_generated.deepcopy.go │ │ │ └── types │ │ │ │ ├── builder.go │ │ │ │ ├── flow.go │ │ │ │ ├── router.go │ │ │ │ ├── stringmaps.go │ │ │ │ ├── stringmaps_test.go │ │ │ │ └── types.go │ │ └── plugins │ │ │ └── plugin.go │ └── static │ │ └── gen │ │ └── crds │ │ └── generated.go └── webhook │ └── podhandler │ ├── helpers.go │ └── podhandler.go ├── renovate.json └── scripts ├── check-header.sh ├── generate.sh └── trigger-docs-update.sh /.dockerignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | build/ 3 | -------------------------------------------------------------------------------- /.fossa.yml: -------------------------------------------------------------------------------- 1 | version: 3 2 | 3 | paths: 4 | exclude: 5 | - ./e2e 6 | -------------------------------------------------------------------------------- /.github/.editorconfig: -------------------------------------------------------------------------------- 1 | [{*.yaml,*.yml}] 2 | indent_size = 2 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/---bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "❗️ Bug report" 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | > Bugs should be filed for issues encountered whilst operating logging-operator. 11 | > You should first attempt to resolve your issues through the community support 12 | > channels, e.g. Slack, in order to rule out individual configuration errors. [#logging-operator](https://slack.banzaicloud.io/) 13 | > Please provide as much detail as possible. 14 | 15 | **Describe the bug**: 16 | A clear and concise description of what the bug is. 17 | 18 | **Expected behaviour**: 19 | A concise description of what you expected to happen. 20 | 21 | **Steps to reproduce the bug**: 22 | Steps to reproduce the bug should be clear and easily reproducible to help people 23 | gain an understanding of the problem. 24 | 25 | **Additional context**: 26 | Add any other context about the problem here. 27 | 28 | **Environment details**: 29 | - Kubernetes version (e.g. v1.15.2): 30 | - Cloud-provider/provisioner (e.g. AKS, GKE, EKS, PKE etc): 31 | - logging-operator version (e.g. 2.1.1): 32 | - Install method (e.g. helm or static manifests): 33 | - Logs from the misbehaving component (and any other relevant logs): 34 | - Resource definition (possibly in YAML format) that caused the issue, without sensitive data: 35 | 36 | /kind bug 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/--feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F680Feature request" 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/archive/trigger-submodule-update.yaml: -------------------------------------------------------------------------------- 1 | name: Trigger docs update 2 | 3 | # on: 4 | # push: 5 | # tags: 6 | # - "[0-9]+.[0-9]+.[0-9]+" 7 | 8 | jobs: 9 | trigger-docs-update: 10 | name: Trigger docs update 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - name: Check out code 15 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 16 | 17 | - name: Set Git refname 18 | id: set-git-refname 19 | run: | 20 | GIT_REFNAME="$(echo "${{ github.ref }}" | sed -r 's@refs/(heads|pull|tags)/@@g')" 21 | 22 | echo "GIT_REFNAME=${GIT_REFNAME}" 23 | echo "git_refname=${GIT_REFNAME}" >> $GITHUB_OUTPUT 24 | 25 | - name: Trigger 26 | env: 27 | GITHUB_TOKEN: '${{ secrets.CR_PAT }}' 28 | run: | 29 | scripts/trigger-docs-update.sh "${{ steps.set-git-refname.outputs.git_refname }}" 30 | -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | # https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes 2 | changelog: 3 | exclude: 4 | labels: 5 | - ignore-for-release-note 6 | categories: 7 | - title: Breaking Changes 8 | labels: 9 | - breaking-change 10 | - title: New Features 11 | labels: 12 | - feature 13 | - title: Enhancements 14 | labels: 15 | - enhancement 16 | - title: Dependency and image updates 17 | labels: 18 | - dependencies 19 | - title: Bug fixes 20 | labels: 21 | - bugfix 22 | - title: Documentation 23 | labels: 24 | - documentation 25 | - title: Testing 26 | labels: 27 | - testing 28 | - title: Other Changes 29 | labels: 30 | - "*" 31 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 60 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | # Label to use when marking an issue as stale 10 | staleLabel: wontfix 11 | # Comment to post when marking an issue as stale. Set to `false` to disable 12 | markComment: > 13 | This issue has been automatically marked as stale because it has not had 14 | recent activity. It will be closed if no further activity occurs. Thank you 15 | for your contributions! 16 | # Comment to post when closing a stale issue. Set to `false` to disable 17 | closeComment: false 18 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | tags: ["[0-9]+.[0-9]+.[0-9]+*"] 6 | 7 | permissions: 8 | contents: read 9 | 10 | jobs: 11 | artifacts: 12 | name: Artifacts 13 | uses: ./.github/workflows/artifacts.yaml 14 | with: 15 | version: ${{ github.ref_name }} 16 | publish: true 17 | release: true 18 | permissions: 19 | contents: read 20 | packages: write 21 | id-token: write 22 | security-events: write 23 | 24 | dependency-images: 25 | name: Dependency images 26 | uses: ./.github/workflows/dependency-images.yaml 27 | with: 28 | fluentd-image-types: "base,filters,full" 29 | publish: true 30 | permissions: 31 | contents: read 32 | packages: write 33 | id-token: write 34 | security-events: write 35 | -------------------------------------------------------------------------------- /.go-version: -------------------------------------------------------------------------------- 1 | 1.24.1 2 | -------------------------------------------------------------------------------- /.golangci.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | run: 3 | timeout: 10m 4 | allow-parallel-runners: true 5 | 6 | formatters: 7 | settings: 8 | gci: 9 | sections: 10 | - standard 11 | - default 12 | - prefix(github.com/kube-logging/logging-operator) 13 | goimports: 14 | local-prefixes: 15 | - github.com/kube-logging/logging-operator 16 | gofmt: 17 | simplify: true 18 | gofumpt: 19 | extra-rules: false 20 | 21 | linters: 22 | settings: 23 | misspell: 24 | locale: US 25 | revive: 26 | confidence: 0.9 27 | gocyclo: 28 | min-complexity: 15 29 | enable: 30 | - bodyclose 31 | - errcheck 32 | - ineffassign 33 | - misspell 34 | - nolintlint 35 | - revive 36 | - unconvert 37 | - unparam 38 | - unused 39 | - whitespace 40 | -------------------------------------------------------------------------------- /.idea/copyright/Kube_Logging_authors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/logging-operator.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.licensei.toml: -------------------------------------------------------------------------------- 1 | approved = [ 2 | "mit", 3 | "mit-0", 4 | "apache-2.0", 5 | "bsd-3-clause", 6 | "bsd-2-clause", 7 | "mpl-2.0", 8 | "isc" 9 | ] 10 | 11 | ignored = [ 12 | "github.com/kube-logging/logging-operator/pkg/sdk", # go submodule 13 | "github.com/davecgh/go-spew", # ISC 14 | # Unsupported VCS 15 | "google.golang.org/protobuf", 16 | "github.com/gogo/protobuf", 17 | "sigs.k8s.io/yaml", 18 | "gomodules.xyz/jsonpatch/v2", 19 | "cloud.google.com/go", 20 | "github.com/form3tech-oss/jwt-go", # MIT 21 | ] 22 | 23 | [header] 24 | ignorePaths = ["vendor"] 25 | ignoreFiles = ["zz_generated.*.go", "generated.go","cache.go"] 26 | authors = ["Banzai Cloud", "Cisco Systems, Inc. and/or its affiliates", "Kube logging authors"] 27 | template = """// Copyright © :YEAR: :AUTHOR: 28 | // 29 | // Licensed under the Apache License, Version 2.0 (the "License"); 30 | // you may not use this file except in compliance with the License. 31 | // You may obtain a copy of the License at 32 | // 33 | // http://www.apache.org/licenses/LICENSE-2.0 34 | // 35 | // Unless required by applicable law or agreed to in writing, software 36 | // distributed under the License is distributed on an "AS IS" BASIS, 37 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 38 | // See the License for the specific language governing permissions and 39 | // limitations under the License.""" 40 | -------------------------------------------------------------------------------- /.testcoverage.yml: -------------------------------------------------------------------------------- 1 | # Configuration file for go-test-coverage 2 | # https://github.com/vladopajic/go-test-coverage 3 | 4 | # (mandatory) 5 | # Path to coverprofile file (output of `go test -coverprofile` command) 6 | profile: build/_test_coverage/coverage_all.out 7 | 8 | # (optional) 9 | # When specified reported file paths will not contain local prefix in the output 10 | local-prefix: "github.com/kube-logging/logging-operator" 11 | -------------------------------------------------------------------------------- /.tool-versions: -------------------------------------------------------------------------------- 1 | golang 1.24.2 2 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | # Maintainers 2 | 3 | | Maintainer | GitHub | Company | Email | 4 | |-------------------|----------------------------------------------------|-----------|-----------------------------------------------------------------| 5 | | Sándor Guba | [@tarokkk](https://github.com/tarokkk) | Axoflow | [gubasanyi@gmail.com](mailto:gubasanyi@gmail.com) | 6 | | Ferenc Hernádi | [@ahma](https://github.com/ahma) | Axoflow | [ferenc.hernadi@gmail.com](mailto:ferenc.hernadi@gmail.com) | 7 | | Péter Wilcsinszky | [@pepov](https://github.com/pepov) | Axoflow | [peterwilcsinszky@gmail.com](mailto:peterwilcsinszky@gmail.com) | 8 | | Márk Sági-Kazár | [@sagikazarmark](https://github.com/sagikazarmark) | OpenMeter | [mark@sagikazarmark.hu](mailto:mark@sagikazarmark.hu) | 9 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright © 2018 Banzai Cloud 2 | Copyright © 2021 Cisco Systems, Inc. and/or its affiliates 3 | Copyright © 2023 Kube logging authors 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. -------------------------------------------------------------------------------- /PROJECT: -------------------------------------------------------------------------------- 1 | version: "2" 2 | domain: banzaicloud.io 3 | repo: github.com/kube-logging/logging-operator 4 | resources: 5 | - group: logging 6 | version: v1beta1 7 | kind: Fluentbit 8 | - group: logging 9 | version: v1beta1 10 | kind: Fluentd 11 | - group: logging 12 | version: v1beta1 13 | kind: Flow 14 | - group: logging 15 | version: v1beta1 16 | kind: ClusterFlow 17 | - group: logging 18 | version: v1beta1 19 | kind: Output 20 | - group: logging 21 | version: v1beta1 22 | kind: ClusterOutput 23 | - group: logging 24 | version: v1beta1 25 | kind: Logging 26 | -------------------------------------------------------------------------------- /charts-docs/README.md: -------------------------------------------------------------------------------- 1 | # Helm chart documentation 2 | 3 | README files for Helm charts are generated using [helm-docs](https://github.com/norwoodj/helm-docs). 4 | 5 | Each chart should contain a `README.md.gotmpl` file that describes how 6 | the `README.md` of the chart should be generated. 7 | 8 | Normally, this file can be the same as the primary template in [docs/templates/README.md.gotmpl] or a symlink pointing to it: 9 | 10 | ```bash 11 | cd charts/CHART 12 | ln -s ../../charts-docs/templates/README.md.gotmpl 13 | ``` 14 | 15 | Copy the file to the chart directory if you want to customize the template. 16 | 17 | **Note:** Don't forget to add `README.md.gotmpl` to `.helmignore`. 18 | 19 | Then run `make docs` in the repository root. 20 | -------------------------------------------------------------------------------- /charts-docs/templates/README.md.gotmpl: -------------------------------------------------------------------------------- 1 | {{ template "chart.header" . }} 2 | 3 | {{ template "chart.typeBadge" . }} {{ template "chart.kubeVersionBadge" . }} {{ template "chart.artifactHubBadge" . }} 4 | 5 | {{ template "chart.description" . }} 6 | 7 | {{ template "chart.homepageLine" . }} 8 | 9 | {{ template "tldr" . }} 10 | 11 | {{ template "chart.valuesSection" . }} 12 | -------------------------------------------------------------------------------- /charts-docs/templates/overrides.gotmpl: -------------------------------------------------------------------------------- 1 | {{- define "chart.typeBadge" -}} 2 | {{- if .Type -}}![type: {{ .Type }}](https://img.shields.io/badge/type-{{ .Type }}-informational?style=flat-square){{- end -}} 3 | {{- end -}} 4 | 5 | {{- define "chart.kubeVersionBadge" -}} 6 | {{- if .KubeVersion -}}![kube version: {{ .KubeVersion }}](https://img.shields.io/badge/kube%20version-{{ .KubeVersion | replace "-" "--" }}-informational?style=flat-square){{- end -}} 7 | {{- end -}} 8 | 9 | {{- define "chart.artifactHubBadge" -}} 10 | [![artifact hub](https://img.shields.io/badge/artifact%20hub-{{ .Name | replace "-" "--" }}-informational?style=flat-square)](https://artifacthub.io/packages/helm/kube-logging/{{ .Name }}) 11 | {{- end -}} 12 | 13 | {{- define "tldr" -}} 14 | ## TL;DR; 15 | 16 | ```bash 17 | helm install --generate-name --wait oci://ghcr.io/kube-logging/helm-charts/{{ .Name }} 18 | ``` 19 | 20 | or to install with a specific version: 21 | 22 | ```bash 23 | helm install --generate-name --wait oci://ghcr.io/kube-logging/helm-charts/{{ .Name }} --version $VERSION 24 | ``` 25 | {{- end -}} 26 | 27 | {{- define "chart.badges" -}} 28 | {{ template "chart.typeBadge" . }} {{ template "chart.kubeVersionBadge" . }} {{ template "chart.artifactHubBadge" . }} 29 | {{- end -}} 30 | 31 | {{- define "chart.baseHead" -}} 32 | {{ template "chart.header" . }} 33 | 34 | {{ template "chart.badges" . }} 35 | 36 | {{ template "chart.description" . }} 37 | 38 | {{ template "chart.homepageLine" . }} 39 | 40 | {{ template "tldr" . }} 41 | {{- end -}} 42 | 43 | {{- define "chart.base" -}} 44 | {{ template "chart.baseHead" . }} 45 | 46 | {{ template "chart.valuesSection" . }} 47 | {{- end -}} 48 | -------------------------------------------------------------------------------- /charts/logging-demo/README.md: -------------------------------------------------------------------------------- 1 | # Logging demo chart 2 | 3 | The chart has been relocated [here](https://github.com/kube-logging/helm-charts/tree/main/charts/logging-demo). 4 | -------------------------------------------------------------------------------- /charts/logging-operator/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *.orig 18 | *~ 19 | # Various IDEs 20 | .project 21 | .idea/ 22 | *.tmproj 23 | .vscode/ 24 | 25 | ci/ 26 | README.md.gotmpl 27 | -------------------------------------------------------------------------------- /charts/logging-operator/Chart.lock: -------------------------------------------------------------------------------- 1 | dependencies: 2 | - name: logging-operator-crds 3 | repository: "" 4 | version: 0.0.0 5 | - name: telemetry-controller 6 | repository: oci://ghcr.io/kube-logging/helm-charts 7 | version: 0.0.18 8 | digest: sha256:7aec221a591393378819b2646901090c32d0d046a43e1da58d92b4042c9542ae 9 | generated: "2025-04-28T10:45:01.44523+02:00" 10 | -------------------------------------------------------------------------------- /charts/logging-operator/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | type: application 3 | name: logging-operator 4 | version: 0.0.0 5 | appVersion: latest 6 | kubeVersion: ">=1.22.0-0" 7 | description: Logging operator for Kubernetes based on Fluentd and Fluentbit. 8 | keywords: 9 | - logging 10 | - fluentd 11 | - fluentbit 12 | home: https://kube-logging.github.io 13 | sources: 14 | - https://github.com/kube-logging/logging-operator 15 | - https://github.com/kube-logging/helm-charts/tree/main/charts/logging-operator 16 | dependencies: 17 | - name: logging-operator-crds 18 | version: 0.0.0 19 | condition: logging-operator-crds.install 20 | - name: telemetry-controller 21 | version: ">=0.0.10" 22 | repository: oci://ghcr.io/kube-logging/helm-charts 23 | condition: telemetry-controller.install 24 | -------------------------------------------------------------------------------- /charts/logging-operator/README.md.gotmpl: -------------------------------------------------------------------------------- 1 | {{ template "chart.baseHead" . }} 2 | 3 | ## Introduction 4 | 5 | This chart bootstraps a [Logging operator](https://github.com/kube-logging/logging-operator) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. 6 | 7 | ## Prerequisites 8 | 9 | - Kubernetes 1.19+ 10 | 11 | ## Installing CRDs 12 | 13 | Use `createCustomResource=false` with Helm v3 to avoid trying to create CRDs from the `crds` folder and from templates at the same time. 14 | 15 | {{ template "chart.valuesSection" . }} 16 | 17 | ## Installing Fluentd and Fluent-bit via logging 18 | 19 | The chart does **not** install `logging` resource to deploy Fluentd (or Syslog-ng) and Fluent-bit on the cluster by default, but 20 | it can be enabled by setting the `logging.enabled` value to true. 21 | -------------------------------------------------------------------------------- /charts/logging-operator/charts/logging-operator-crds/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: logging-operator-crds 3 | version: 0.0.0 4 | -------------------------------------------------------------------------------- /charts/logging-operator/charts/logging-operator-crds/README.md: -------------------------------------------------------------------------------- 1 | # logging-operator-crds 2 | 3 | ![Version: 0.0.0](https://img.shields.io/badge/Version-0.0.0-informational?style=flat-square) 4 | 5 | ## Values 6 | 7 | | Key | Type | Default | Description | 8 | |-----|------|---------|-------------| 9 | | annotations | object | `{}` | Define annotations for CRDs | 10 | 11 | ---------------------------------------------- 12 | Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) 13 | -------------------------------------------------------------------------------- /charts/logging-operator/charts/logging-operator-crds/values.yaml: -------------------------------------------------------------------------------- 1 | # -- Define annotations for CRDs 2 | annotations: {} 3 | # argocd.argoproj.io/sync-options: Replace=false,ServerSideApply=true 4 | -------------------------------------------------------------------------------- /charts/logging-operator/templates/NOTES.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kube-logging/logging-operator/1f642a8b20c7bb6ced66c7611b296a19b620358e/charts/logging-operator/templates/NOTES.txt -------------------------------------------------------------------------------- /charts/logging-operator/templates/clusterrolebinding.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.rbac.enabled }} 2 | --- 3 | apiVersion: rbac.authorization.k8s.io/v1 4 | kind: ClusterRoleBinding 5 | metadata: 6 | name: {{ template "logging-operator.fullname" . }} 7 | annotations: 8 | {{- if .Values.rbac.retainOnDelete }} 9 | "helm.sh/resource-policy": keep 10 | {{- end }} 11 | labels: 12 | {{ include "logging-operator.labels" . | indent 4 }} 13 | subjects: 14 | - kind: ServiceAccount 15 | name: {{ template "logging-operator.fullname" . }} 16 | namespace: {{ include "logging-operator.namespace" . }} 17 | roleRef: 18 | apiGroup: rbac.authorization.k8s.io 19 | kind: ClusterRole 20 | name: {{ template "logging-operator.fullname" . }} 21 | {{- end }} 22 | -------------------------------------------------------------------------------- /charts/logging-operator/templates/crds.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.createCustomResource -}} 2 | {{- range $path, $bytes := .Files.Glob "crds/*.yaml" }} 3 | {{ $.Files.Get $path }} 4 | --- 5 | {{- end }} 6 | {{- end }} 7 | -------------------------------------------------------------------------------- /charts/logging-operator/templates/extra-manifests.yaml: -------------------------------------------------------------------------------- 1 | {{ range .Values.extraManifests }} 2 | --- 3 | {{ tpl (toYaml .) $ }} 4 | {{ end }} 5 | -------------------------------------------------------------------------------- /charts/logging-operator/templates/logging/clusterflows.yaml: -------------------------------------------------------------------------------- 1 | {{ if .Values.logging.enabled -}} 2 | {{- range $clusterflow := .Values.logging.clusterFlows }} 3 | --- 4 | apiVersion: logging.banzaicloud.io/v1beta1 5 | kind: ClusterFlow 6 | metadata: 7 | name: {{ $clusterflow.name }} 8 | namespace: {{ $.Values.logging.controlNamespace | default $.Release.Namespace }} 9 | labels: 10 | {{ include "logging-operator.labels" $ | indent 4 }} 11 | spec: 12 | {{ toYaml $clusterflow.spec | indent 2 }} 13 | {{- end -}} 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /charts/logging-operator/templates/logging/clusteroutputs.yaml: -------------------------------------------------------------------------------- 1 | {{ if .Values.logging.enabled -}} 2 | {{- range $clusteroutput := .Values.logging.clusterOutputs }} 3 | --- 4 | apiVersion: logging.banzaicloud.io/v1beta1 5 | kind: ClusterOutput 6 | metadata: 7 | name: {{ $clusteroutput.name }} 8 | namespace: {{ $.Values.logging.controlNamespace | default $.Release.Namespace }} 9 | labels: 10 | {{ include "logging-operator.labels" $ | indent 4 }} 11 | spec: 12 | {{ toYaml $clusteroutput.spec | indent 2 }} 13 | {{- end -}} 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /charts/logging-operator/templates/logging/eventtailer.yaml: -------------------------------------------------------------------------------- 1 | {{- with $.Values.logging.eventTailer }} 2 | {{- if and $.Values.logging.enabled .enabled }} 3 | apiVersion: logging-extensions.banzaicloud.io/v1alpha1 4 | kind: EventTailer 5 | metadata: 6 | name: {{ .name }} 7 | spec: 8 | controlNamespace: {{ $.Values.logging.controlNamespace | default $.Release.Namespace }} 9 | {{- with .image }} 10 | image: 11 | {{- toYaml . | nindent 4 }} 12 | {{- end }} 13 | {{- with .pvc }} 14 | {{- if .enabled }} 15 | positionVolume: 16 | pvc: 17 | spec: 18 | accessModes: {{ .accessModes }} 19 | resources: 20 | requests: 21 | storage: {{ .storage }} 22 | volumeMode: {{ .volumeMode }} 23 | {{- with .storageClassName }} 24 | storageClassName: {{ . }} 25 | {{- end }} 26 | {{- end }}{{/* end if enabled */}} 27 | {{- end }}{{/* end with pvc */}} 28 | {{- with .workloadMetaOverrides }} 29 | workloadMetaOverrides: 30 | {{- toYaml . | nindent 4 }} 31 | {{- end }} 32 | {{- with .workloadOverrides }} 33 | workloadOverrides: 34 | {{- toYaml . | nindent 4 }} 35 | {{- end }} 36 | {{- with .containerOverrides }} 37 | containerOverrides: 38 | {{- toYaml . | nindent 4 }} 39 | {{- end }} 40 | {{- end }}{{/* end if enabled */}} 41 | {{- end }}{{/* end with event-tailer */}} 42 | -------------------------------------------------------------------------------- /charts/logging-operator/templates/logging/fluentbit.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.logging.enabled (not .Values.logging.fluentbitDisabled) -}} 2 | {{- $fluentbitSpec := .Values.logging.fluentbit }} 3 | {{- if .Values.logging.loggingRef }} 4 | {{- $fluentbitSpec := set .Values.logging.fluentbit "loggingRef" (default .Values.logging.loggingRef .Values.logging.fluentbit.loggingRef) -}} 5 | {{- end }} 6 | 7 | apiVersion: logging.banzaicloud.io/v1beta1 8 | kind: FluentbitAgent 9 | metadata: 10 | name: {{ include "logging-operator.releasename" . }} 11 | labels: {{ include "logging-operator.labels" . | nindent 4 }} 12 | {{- if $fluentbitSpec }} 13 | spec: {{- toYaml $fluentbitSpec | nindent 2 }} 14 | {{- else }} 15 | spec: {} 16 | {{- end }} 17 | {{- end }} 18 | -------------------------------------------------------------------------------- /charts/logging-operator/templates/logging/hosttailer.yaml: -------------------------------------------------------------------------------- 1 | {{- with .Values.logging.hostTailer }} 2 | {{- if and $.Values.logging.enabled .enabled }} 3 | --- 4 | apiVersion: logging-extensions.banzaicloud.io/v1alpha1 5 | kind: HostTailer 6 | metadata: 7 | name: {{ .name }} 8 | spec: 9 | {{- with .fileTailers }} 10 | fileTailers: 11 | {{- toYaml . | nindent 4 }} 12 | {{- end }} 13 | {{- with .systemdTailers }} 14 | systemdTailers: 15 | {{- toYaml . | nindent 4 }} 16 | {{- end }} 17 | enableRecreateWorkloadOnImmutableFieldChange: {{ $.Values.logging.enableRecreateWorkloadOnImmutableFieldChange }} 18 | {{- with .workloadMetaOverrides }} 19 | workloadMetaOverrides: 20 | {{- toYaml . | nindent 4 }} 21 | {{- end }} 22 | {{- with .workloadOverrides }} 23 | workloadOverrides: 24 | {{- toYaml . | nindent 4 }} 25 | {{- end }} 26 | {{- with .image }} 27 | image: 28 | {{- toYaml . | nindent 4 }} 29 | {{- end }} 30 | {{- end }} 31 | {{- end }} 32 | -------------------------------------------------------------------------------- /charts/logging-operator/templates/logging/hosttailers.yaml: -------------------------------------------------------------------------------- 1 | {{- if and $.Values.logging.enabled $.Values.logging.hostTailers.enabled }} 2 | {{- range .Values.logging.hostTailers.instances }} 3 | {{- if .enabled }} 4 | --- 5 | apiVersion: logging-extensions.banzaicloud.io/v1alpha1 6 | kind: HostTailer 7 | metadata: 8 | name: {{ .name }} 9 | spec: 10 | {{- with .fileTailers }} 11 | fileTailers: 12 | {{- toYaml . | nindent 4 }} 13 | {{- end }} 14 | {{- with .systemdTailers }} 15 | systemdTailers: 16 | {{- toYaml . | nindent 4 }} 17 | {{- end }} 18 | enableRecreateWorkloadOnImmutableFieldChange: {{ $.Values.logging.enableRecreateWorkloadOnImmutableFieldChange }} 19 | {{- with .workloadMetaOverrides }} 20 | workloadMetaOverrides: 21 | {{- toYaml . | nindent 4 }} 22 | {{- end }} 23 | {{- with .workloadOverrides }} 24 | workloadOverrides: 25 | {{- toYaml . | nindent 4 }} 26 | {{- end }} 27 | {{- with .image }} 28 | image: 29 | {{- toYaml . | nindent 4 }} 30 | {{- end }} 31 | {{- end }} 32 | {{- end }} 33 | {{- end }} 34 | -------------------------------------------------------------------------------- /charts/logging-operator/templates/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ include "logging-operator.fullname" . }} 5 | namespace: {{ include "logging-operator.namespace" . }} 6 | labels: 7 | {{ include "logging-operator.labels" . | indent 4 }} 8 | spec: 9 | type: {{ .Values.http.service.type }} 10 | {{- with .Values.http.service.clusterIP }} 11 | clusterIP: {{ . }} 12 | {{- end }} 13 | ports: 14 | - port: {{ .Values.http.port }} 15 | targetPort: http 16 | protocol: TCP 17 | name: http 18 | selector: 19 | app.kubernetes.io/name: {{ include "logging-operator.name" . }} 20 | app.kubernetes.io/instance: {{ .Release.Name }} 21 | -------------------------------------------------------------------------------- /charts/logging-operator/templates/service_monitor.yaml: -------------------------------------------------------------------------------- 1 | {{ if and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") .Values.monitoring.serviceMonitor.enabled }} 2 | apiVersion: monitoring.coreos.com/v1 3 | kind: ServiceMonitor 4 | metadata: 5 | name: {{ include "logging-operator.fullname" . }} 6 | namespace: {{ include "logging-operator.namespace" . }} 7 | labels: 8 | {{ include "logging-operator.labels" . | indent 4 }} 9 | {{- with .Values.monitoring.serviceMonitor.additionalLabels }} 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | spec: 13 | selector: 14 | matchLabels: 15 | {{ include "logging-operator.labels" . | indent 6 }} 16 | endpoints: 17 | - port: http 18 | path: /metrics 19 | {{- with .Values.monitoring.serviceMonitor.metricRelabelings }} 20 | metricRelabelings: 21 | {{- toYaml . | nindent 6 }} 22 | {{- end }} 23 | {{- with .Values.monitoring.serviceMonitor.relabelings }} 24 | relabelings: 25 | {{- toYaml . | nindent 4 }} 26 | {{- end }} 27 | namespaceSelector: 28 | matchNames: 29 | - {{ include "logging-operator.namespace" . }} 30 | {{- end }} 31 | -------------------------------------------------------------------------------- /charts/logging-operator/templates/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.rbac.enabled }} 2 | --- 3 | apiVersion: v1 4 | kind: ServiceAccount 5 | metadata: 6 | name: {{ template "logging-operator.fullname" . }} 7 | namespace: {{ include "logging-operator.namespace" . }} 8 | labels: 9 | {{ include "logging-operator.labels" . | indent 4 }} 10 | annotations: 11 | {{- if .Values.rbac.retainOnDelete }} 12 | "helm.sh/resource-policy": keep 13 | {{- end }} 14 | {{- with .Values.serviceAccount.annotations }} 15 | {{ toYaml . | indent 4 }} 16 | {{- end }} 17 | {{- end }} 18 | -------------------------------------------------------------------------------- /charts/logging-operator/values-logging-example.yaml: -------------------------------------------------------------------------------- 1 | nameOverride: example 2 | 3 | # given we use `nameOverride: example` if testReceiver is enabled we can send http metrics to http://example-test-receiver:8080 4 | testReceiver: 5 | enabled: true 6 | 7 | logging: 8 | enabled: true 9 | clusterFlows: 10 | - name: all 11 | spec: 12 | match: 13 | - select: {} 14 | globalOutputRefs: ["http"] 15 | clusterOutputs: 16 | - name: http 17 | spec: 18 | http: 19 | endpoint: http://example-test-receiver:8080 20 | content_type: application/json 21 | buffer: 22 | type: memory 23 | timekey: 1s 24 | timekey_wait: 1s 25 | -------------------------------------------------------------------------------- /config/certmanager/certificate.yaml: -------------------------------------------------------------------------------- 1 | # The following manifests contain a self-signed issuer CR and a certificate CR. 2 | # More document can be found at https://docs.cert-manager.io 3 | apiVersion: certmanager.k8s.io/v1alpha1 4 | kind: Issuer 5 | metadata: 6 | name: selfsigned-issuer 7 | namespace: system 8 | spec: 9 | selfSigned: {} 10 | --- 11 | apiVersion: certmanager.k8s.io/v1alpha1 12 | kind: Certificate 13 | metadata: 14 | name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml 15 | namespace: system 16 | spec: 17 | # $(SERVICENAME) and $(NAMESPACE) will be substituted by kustomize 18 | commonName: $(SERVICENAME).$(NAMESPACE).svc 19 | dnsNames: 20 | - $(SERVICENAME).$(NAMESPACE).svc.cluster.local 21 | issuerRef: 22 | kind: Issuer 23 | name: selfsigned-issuer 24 | secretName: webhook-server-cert # this secret will not be prefixed, since it's not managed by kustomize 25 | -------------------------------------------------------------------------------- /config/certmanager/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - certificate.yaml 3 | 4 | # the following config is for teaching kustomize how to do var substitution 5 | vars: 6 | - name: NAMESPACE # namespace of the service and the certificate CR 7 | objref: 8 | kind: Service 9 | version: v1 10 | name: webhook-service 11 | fieldref: 12 | fieldpath: metadata.namespace 13 | - name: CERTIFICATENAME 14 | objref: 15 | kind: Certificate 16 | group: certmanager.k8s.io 17 | version: v1alpha1 18 | name: serving-cert # this name should match the one in certificate.yaml 19 | - name: SERVICENAME 20 | objref: 21 | kind: Service 22 | version: v1 23 | name: webhook-service 24 | 25 | configurations: 26 | - kustomizeconfig.yaml 27 | -------------------------------------------------------------------------------- /config/certmanager/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # This configuration is for teaching kustomize how to update name ref and var substitution 2 | nameReference: 3 | - kind: Issuer 4 | group: certmanager.k8s.io 5 | fieldSpecs: 6 | - kind: Certificate 7 | group: certmanager.k8s.io 8 | path: spec/issuerRef/name 9 | 10 | varReference: 11 | - kind: Certificate 12 | group: certmanager.k8s.io 13 | path: spec/commonName 14 | - kind: Certificate 15 | group: certmanager.k8s.io 16 | path: spec/dnsNames 17 | -------------------------------------------------------------------------------- /config/crd/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # This file is for teaching kustomize how to substitute name and namespace reference in CRD 2 | nameReference: 3 | - kind: Service 4 | version: v1 5 | fieldSpecs: 6 | - kind: CustomResourceDefinition 7 | group: apiextensions.k8s.io 8 | path: spec/conversion/webhookClientConfig/service/name 9 | 10 | namespace: 11 | - kind: CustomResourceDefinition 12 | group: apiextensions.k8s.io 13 | path: spec/conversion/webhookClientConfig/service/namespace 14 | create: false 15 | 16 | varReference: 17 | - path: metadata/annotations 18 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_clusterflows.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | certmanager.k8s.io/inject-ca-from: $(NAMESPACE)/$(CERTIFICATENAME) 8 | name: clusterflows.logging.banzaicloud.io 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_clusteroutputs.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | certmanager.k8s.io/inject-ca-from: $(NAMESPACE)/$(CERTIFICATENAME) 8 | name: clusteroutputs.logging.banzaicloud.io 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_flows.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | certmanager.k8s.io/inject-ca-from: $(NAMESPACE)/$(CERTIFICATENAME) 8 | name: flows.logging.banzaicloud.io 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_fluentbits.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | certmanager.k8s.io/inject-ca-from: $(NAMESPACE)/$(CERTIFICATENAME) 8 | name: fluentbits.logging.banzaicloud.io 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_fluentds.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | certmanager.k8s.io/inject-ca-from: $(NAMESPACE)/$(CERTIFICATENAME) 8 | name: fluentds.logging.banzaicloud.io 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_loggings.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 8 | name: loggings.logging.banzaicloud.io 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_outputs.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | certmanager.k8s.io/inject-ca-from: $(NAMESPACE)/$(CERTIFICATENAME) 8 | name: outputs.logging.banzaicloud.io 9 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_clusterflows.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: clusterflows.logging.banzaicloud.io 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhookClientConfig: 11 | # this "\n" is used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 12 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 13 | caBundle: Cg== 14 | service: 15 | namespace: system 16 | name: webhook-service 17 | path: /convert 18 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_clusteroutputs.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: clusteroutputs.logging.banzaicloud.io 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhookClientConfig: 11 | # this "\n" is used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 12 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 13 | caBundle: Cg== 14 | service: 15 | namespace: system 16 | name: webhook-service 17 | path: /convert 18 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_flows.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: flows.logging.banzaicloud.io 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhookClientConfig: 11 | # this "\n" is used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 12 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 13 | caBundle: Cg== 14 | service: 15 | namespace: system 16 | name: webhook-service 17 | path: /convert 18 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_fluentbits.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: fluentbits.logging.banzaicloud.io 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhookClientConfig: 11 | # this "\n" is used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 12 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 13 | caBundle: Cg== 14 | service: 15 | namespace: system 16 | name: webhook-service 17 | path: /convert 18 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_fluentds.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: fluentds.logging.banzaicloud.io 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhookClientConfig: 11 | # this "\n" is used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 12 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 13 | caBundle: Cg== 14 | service: 15 | namespace: system 16 | name: webhook-service 17 | path: /convert 18 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_loggings.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: loggings.logging.banzaicloud.io 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhookClientConfig: 11 | # this "\n" is used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 12 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 13 | caBundle: Cg== 14 | service: 15 | namespace: system 16 | name: webhook-service 17 | path: /convert 18 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_outputs.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1beta1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: outputs.logging.banzaicloud.io 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhookClientConfig: 11 | # this "\n" is used as a placeholder, otherwise it will be rejected by the apiserver for being blank, 12 | # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) 13 | caBundle: Cg== 14 | service: 15 | namespace: system 16 | name: webhook-service 17 | path: /convert 18 | -------------------------------------------------------------------------------- /config/default/manager_auth_proxy_patch.yaml: -------------------------------------------------------------------------------- 1 | # This patch inject a sidecar container which is a HTTP proxy for the controller manager, 2 | # it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews. 3 | apiVersion: apps/v1 4 | kind: Deployment 5 | metadata: 6 | name: controller-manager 7 | namespace: system 8 | spec: 9 | template: 10 | spec: 11 | containers: 12 | - name: kube-rbac-proxy 13 | image: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.0 14 | args: 15 | - "--secure-listen-address=0.0.0.0:8443" 16 | - "--upstream=http://127.0.0.1:8080/" 17 | - "--logtostderr=true" 18 | - "--v=10" 19 | ports: 20 | - containerPort: 8443 21 | name: https 22 | - name: manager 23 | args: 24 | - "--metrics-addr=127.0.0.1:8080" 25 | -------------------------------------------------------------------------------- /config/default/manager_image_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | # Change the value of image field below to your controller image URL 11 | - image: controller:local 12 | name: manager 13 | -------------------------------------------------------------------------------- /config/default/manager_image_patch.yaml-e: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | # Change the value of image field below to your controller image URL 11 | - image: controller:local 12 | name: manager 13 | -------------------------------------------------------------------------------- /config/default/manager_prometheus_metrics_patch.yaml: -------------------------------------------------------------------------------- 1 | # This patch enables Prometheus scraping for the manager pod. 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: controller-manager 6 | namespace: system 7 | spec: 8 | template: 9 | metadata: 10 | annotations: 11 | prometheus.io/scrape: 'true' 12 | spec: 13 | containers: 14 | # Expose the prometheus metrics on default port 15 | - name: manager 16 | ports: 17 | - containerPort: 8080 18 | name: metrics 19 | protocol: TCP 20 | -------------------------------------------------------------------------------- /config/default/manager_webhook_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | ports: 12 | - containerPort: 443 13 | name: webhook-server 14 | protocol: TCP 15 | volumeMounts: 16 | - mountPath: /tmp/k8s-webhook-server/serving-certs 17 | name: cert 18 | readOnly: true 19 | volumes: 20 | - name: cert 21 | secret: 22 | defaultMode: 420 23 | secretName: webhook-server-cert 24 | -------------------------------------------------------------------------------- /config/default/webhookcainjection_patch.yaml: -------------------------------------------------------------------------------- 1 | # This patch add annotation to admission webhook config and 2 | # the variables $(NAMESPACE) and $(CERTIFICATENAME) will be substituted by kustomize. 3 | apiVersion: admissionregistration.k8s.io/v1beta1 4 | kind: MutatingWebhookConfiguration 5 | metadata: 6 | name: mutating-webhook-configuration 7 | annotations: 8 | certmanager.k8s.io/inject-ca-from: $(NAMESPACE)/$(CERTIFICATENAME) 9 | --- 10 | apiVersion: admissionregistration.k8s.io/v1beta1 11 | kind: ValidatingWebhookConfiguration 12 | metadata: 13 | name: validating-webhook-configuration 14 | annotations: 15 | certmanager.k8s.io/inject-ca-from: $(NAMESPACE)/$(CERTIFICATENAME) 16 | -------------------------------------------------------------------------------- /config/manager/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - manager.yaml 3 | -------------------------------------------------------------------------------- /config/manager/manager.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | labels: 5 | control-plane: controller-manager 6 | name: system 7 | --- 8 | apiVersion: apps/v1 9 | kind: Deployment 10 | metadata: 11 | name: controller-manager 12 | namespace: system 13 | labels: 14 | control-plane: controller-manager 15 | spec: 16 | selector: 17 | matchLabels: 18 | control-plane: controller-manager 19 | replicas: 1 20 | template: 21 | metadata: 22 | labels: 23 | control-plane: controller-manager 24 | spec: 25 | containers: 26 | - command: 27 | - /manager 28 | args: 29 | - --enable-leader-election 30 | image: controller:local 31 | name: manager 32 | resources: 33 | limits: 34 | cpu: 100m 35 | memory: 30Mi 36 | requests: 37 | cpu: 100m 38 | memory: 20Mi 39 | terminationGracePeriodSeconds: 10 40 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: proxy-role 5 | rules: 6 | - apiGroups: ["authentication.k8s.io"] 7 | resources: 8 | - tokenreviews 9 | verbs: ["create"] 10 | - apiGroups: ["authorization.k8s.io"] 11 | resources: 12 | - subjectaccessreviews 13 | verbs: ["create"] 14 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: proxy-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: proxy-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: default 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | prometheus.io/port: "8443" 6 | prometheus.io/scheme: https 7 | prometheus.io/scrape: "true" 8 | labels: 9 | control-plane: controller-manager 10 | name: controller-manager-metrics-service 11 | namespace: system 12 | spec: 13 | ports: 14 | - name: https 15 | port: 8443 16 | targetPort: https 17 | selector: 18 | control-plane: controller-manager 19 | -------------------------------------------------------------------------------- /config/rbac/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - role.yaml 3 | - role_binding.yaml 4 | - leader_election_role.yaml 5 | - leader_election_role_binding.yaml 6 | # Comment the following 3 lines if you want to disable 7 | # the auth proxy (https://github.com/brancz/kube-rbac-proxy) 8 | # which protects your /metrics endpoint. 9 | - auth_proxy_service.yaml 10 | - auth_proxy_role.yaml 11 | - auth_proxy_role_binding.yaml 12 | -------------------------------------------------------------------------------- /config/rbac/leader_election_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do leader election. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: Role 4 | metadata: 5 | name: leader-election-role 6 | rules: 7 | - apiGroups: 8 | - "" 9 | resources: 10 | - configmaps 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - create 16 | - update 17 | - patch 18 | - delete 19 | - apiGroups: 20 | - "" 21 | resources: 22 | - configmaps/status 23 | verbs: 24 | - get 25 | - update 26 | - patch 27 | -------------------------------------------------------------------------------- /config/rbac/leader_election_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: RoleBinding 3 | metadata: 4 | name: leader-election-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: Role 8 | name: leader-election-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: default 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/rbac/role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: manager-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: manager-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: default 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/samples/all-to-file.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: all-to-file 5 | spec: 6 | fluentd: {} 7 | controlNamespace: default 8 | --- 9 | apiVersion: logging.banzaicloud.io/v1beta1 10 | kind: FluentbitAgent 11 | metadata: 12 | name: all-to-file 13 | spec: 14 | positiondb: 15 | hostPath: 16 | path: "" 17 | bufferStorageVolume: 18 | hostPath: 19 | path: "" 20 | --- 21 | apiVersion: logging.banzaicloud.io/v1beta1 22 | kind: Flow 23 | metadata: 24 | name: all 25 | spec: 26 | filters: 27 | - tag_normaliser: {} 28 | match: 29 | - select: {} 30 | localOutputRefs: 31 | - file 32 | --- 33 | apiVersion: logging.banzaicloud.io/v1beta1 34 | kind: Output 35 | metadata: 36 | name: file 37 | spec: 38 | file: 39 | path: /tmp/logs/${tag} 40 | append: true 41 | buffer: 42 | timekey: 1m 43 | timekey_wait: 10s 44 | timekey_use_utc: true 45 | -------------------------------------------------------------------------------- /config/samples/all-to-stdout-nslabel.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: all-to-file 5 | spec: 6 | fluentd: {} 7 | controlNamespace: default 8 | --- 9 | apiVersion: logging.banzaicloud.io/v1beta1 10 | kind: FluentbitAgent 11 | metadata: 12 | name: all-to-file 13 | spec: 14 | filterKubernetes: 15 | namespace_labels: "On" 16 | --- 17 | apiVersion: logging.banzaicloud.io/v1beta1 18 | kind: ClusterFlow 19 | metadata: 20 | name: all 21 | spec: 22 | filters: 23 | - stdout: {} 24 | match: 25 | - select: 26 | namespace_labels: 27 | # add this label to one or more of the desired namespaces 28 | kube-logging.dev: test 29 | globalOutputRefs: 30 | - nullout 31 | --- 32 | apiVersion: logging.banzaicloud.io/v1beta1 33 | kind: ClusterOutput 34 | metadata: 35 | name: nullout 36 | spec: 37 | nullout: {} 38 | -------------------------------------------------------------------------------- /config/samples/all-to-stdout.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: all-to-file 5 | spec: 6 | fluentd: {} 7 | controlNamespace: default 8 | --- 9 | apiVersion: logging.banzaicloud.io/v1beta1 10 | kind: FluentbitAgent 11 | metadata: 12 | name: all-to-file 13 | spec: 14 | positiondb: 15 | hostPath: 16 | path: "" 17 | bufferStorageVolume: 18 | hostPath: 19 | path: "" 20 | --- 21 | apiVersion: logging.banzaicloud.io/v1beta1 22 | kind: Flow 23 | metadata: 24 | name: all 25 | spec: 26 | filters: 27 | - stdout: {} 28 | match: 29 | - select: {} 30 | localOutputRefs: 31 | - nullout 32 | --- 33 | apiVersion: logging.banzaicloud.io/v1beta1 34 | kind: Output 35 | metadata: 36 | name: nullout 37 | spec: 38 | nullout: {} 39 | -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_cluster_output_custom.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: control 5 | --- 6 | apiVersion: logging.banzaicloud.io/v1beta1 7 | kind: ClusterOutput 8 | metadata: 9 | name: output-custom-cluster 10 | namespace: control 11 | spec: 12 | loggingRef: customref 13 | nullout: {} -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_flow.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: custom 5 | --- 6 | apiVersion: logging.banzaicloud.io/v1beta1 7 | kind: Flow 8 | metadata: 9 | name: flow-sample 10 | spec: 11 | selectors: 12 | sampleKey: sampleValue 13 | filters: 14 | - stdout: {} 15 | localOutputRefs: 16 | - "output-sample" 17 | -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_flow_custom.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Flow 3 | metadata: 4 | name: flow-custom 5 | namespace: custom 6 | spec: 7 | loggingRef: customref 8 | selectors: 9 | sampleKey: customValue 10 | filters: 11 | - stdout: {} 12 | localOutputRefs: 13 | - "output-custom" 14 | - "output-custom-cluster" 15 | -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_logging_custom.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: customlogging 5 | spec: 6 | loggingRef: customref 7 | fluentd: { 8 | disablePvc: true 9 | } 10 | watchNamespaces: ["custom"] 11 | controlNamespace: control 12 | 13 | -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_logging_debug.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: defaultlogging 5 | spec: 6 | fluentd: 7 | logFormat: text 8 | logLevel: debug 9 | disablePvc: true 10 | fluentbit: 11 | image: 12 | tag: 1.9.10-debug 13 | repository: fluent/fluent-bit 14 | pullPolicy: IfNotPresent 15 | controlNamespace: default 16 | -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_logging_default.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: defaultlogging 5 | spec: 6 | fluentd: 7 | disablePvc: true 8 | fluentbit: {} 9 | controlNamespace: default 10 | -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_logging_disablelogrotate.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: defaultlogging 5 | spec: 6 | fluentd: 7 | disablePvc: true 8 | fluentOutLogrotate: 9 | enabled: false 10 | fluentbit: {} 11 | controlNamespace: default 12 | -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_logging_labels.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: defaultlogging 5 | spec: 6 | fluentd: 7 | disablePvc: true 8 | labels: 9 | a: b 10 | fluentbit: 11 | labels: 12 | c: d 13 | controlNamespace: default -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_logging_psp.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: defaultlogging 5 | spec: 6 | fluentd: 7 | security: 8 | podSecurityPolicyCreate: true 9 | fluentbit: 10 | security: 11 | podSecurityPolicyCreate: true 12 | controlNamespace: default 13 | -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_logging_pvc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: defaultlogging 5 | spec: 6 | fluentd: 7 | bufferStorageVolume: 8 | pvc: 9 | spec: 10 | accessModes: 11 | - ReadWriteOnce 12 | resources: 13 | requests: 14 | storage: 1Gi 15 | volumeMode: Filesystem 16 | fluentbit: {} 17 | controlNamespace: default 18 | -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_logging_tailer.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: defaultlogging 5 | spec: 6 | fluentd: {} 7 | fluentbit: {} 8 | controlNamespace: default 9 | -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_multiflow.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Output 3 | metadata: 4 | name: output-sample 5 | spec: 6 | nullout: {} 7 | --- 8 | apiVersion: logging.banzaicloud.io/v1beta1 9 | kind: Flow 10 | metadata: 11 | name: sample1 12 | spec: 13 | selectors: 14 | sampleKey: sampleValue1 15 | filters: 16 | - tag_normaliser: {} 17 | - stdout: {} 18 | localOutputRefs: 19 | - "output-sample" 20 | --- 21 | apiVersion: logging.banzaicloud.io/v1beta1 22 | kind: Flow 23 | metadata: 24 | name: sample2 25 | spec: 26 | selectors: 27 | sampleKey: sampleValue2 28 | filters: 29 | - tag_normaliser: {} 30 | - stdout: {} 31 | localOutputRefs: 32 | - "output-sample" 33 | --- 34 | apiVersion: logging.banzaicloud.io/v1beta1 35 | kind: Flow 36 | metadata: 37 | name: sample3 38 | spec: 39 | selectors: 40 | sampleKey: sampleValue3 41 | filters: 42 | - tag_normaliser: {} 43 | - stdout: {} 44 | localOutputRefs: 45 | - "output-sample" 46 | --- 47 | apiVersion: logging.banzaicloud.io/v1beta1 48 | kind: Flow 49 | metadata: 50 | name: sample4 51 | spec: 52 | selectors: 53 | sampleKey: sampleValue4 54 | filters: 55 | - tag_normaliser: {} 56 | - stdout: {} 57 | localOutputRefs: 58 | - "output-sample" 59 | --- 60 | apiVersion: logging.banzaicloud.io/v1beta1 61 | kind: Flow 62 | metadata: 63 | name: sample5 64 | spec: 65 | selectors: 66 | sampleKey: sampleValue5 67 | filters: 68 | - tag_normaliser: {} 69 | - stdout: {} 70 | localOutputRefs: 71 | - "output-sample" 72 | --- 73 | -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_nodeagent.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: nodeagent 5 | spec: 6 | controlNamespace: default 7 | nodeAgents: 8 | - name: fluentbit-inline 9 | nodeAgentFluentbit: {} 10 | - name: fluentbit-standalone 11 | nodeAgentFluentbit: { } 12 | --- 13 | apiVersion: logging.banzaicloud.io/v1beta1 14 | kind: NodeAgent 15 | metadata: 16 | name: fluentbit-standalone 17 | spec: 18 | nodeAgentFluentbit: {} -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_nodeagent_loggingref.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: nodeagent-withref 5 | spec: 6 | loggingRef: nodeagent 7 | controlNamespace: default 8 | --- 9 | apiVersion: logging.banzaicloud.io/v1beta1 10 | kind: NodeAgent 11 | metadata: 12 | name: fluentbit-withref 13 | spec: 14 | loggingRef: nodeagent 15 | nodeAgentFluentbit: {} -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_output.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Output 3 | metadata: 4 | name: output-sample 5 | spec: 6 | nullout: {} -------------------------------------------------------------------------------- /config/samples/archive/logging_v1alpha2_output_custom.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Output 3 | metadata: 4 | name: output-custom 5 | namespace: custom 6 | spec: 7 | loggingRef: customref 8 | nullout: {} -------------------------------------------------------------------------------- /config/samples/configcheck-timeout-syslog-ng.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: all-to-file 5 | spec: 6 | configCheck: 7 | strategy: StartWithTimeout 8 | timeoutSeconds: 5 9 | syslogNG: {} 10 | controlNamespace: default 11 | --- 12 | apiVersion: logging.banzaicloud.io/v1beta1 13 | kind: Flow 14 | metadata: 15 | name: all 16 | spec: 17 | filters: 18 | - tag_normaliser: {} 19 | match: 20 | - select: {} 21 | localOutputRefs: 22 | - nullout 23 | --- 24 | apiVersion: logging.banzaicloud.io/v1beta1 25 | kind: Output 26 | metadata: 27 | name: nullout 28 | spec: 29 | nullout: {} 30 | -------------------------------------------------------------------------------- /config/samples/configcheck-timeout.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: all-to-file 5 | spec: 6 | # Default configcheck settings can be defined on the logging level 7 | configCheck: 8 | strategy: StartWithTimeout 9 | timeoutSeconds: 5 10 | controlNamespace: default 11 | --- 12 | apiVersion: logging.banzaicloud.io/v1beta1 13 | kind: FluentdConfig 14 | metadata: 15 | name: all-to-file 16 | spec: 17 | # overrides default settings in logging resource 18 | configCheck: 19 | strategy: StartWithTimeout 20 | timeoutSeconds: 3 21 | --- 22 | apiVersion: logging.banzaicloud.io/v1beta1 23 | kind: Flow 24 | metadata: 25 | name: all 26 | spec: 27 | filters: 28 | - tag_normaliser: {} 29 | match: 30 | - select: {} 31 | localOutputRefs: 32 | - nullout 33 | --- 34 | apiVersion: logging.banzaicloud.io/v1beta1 35 | kind: Output 36 | metadata: 37 | name: nullout 38 | spec: 39 | nullout: {} 40 | -------------------------------------------------------------------------------- /config/samples/containerd-log.yaml: -------------------------------------------------------------------------------- 1 | # start minikube with containerd 2 | # minikube start --driver=docker --container-runtime=containerd 3 | # install some workload that generates json and non-json logs 4 | # helm upgrade --install log-generator kube-logging/log-generator --set app.golang=true 5 | # verify produced logs in the fluentd container (json logs should be expanded) 6 | # kubectl exec -ti containerd-fluentd-0 -- tail -f /fluentd/log/out 7 | apiVersion: logging.banzaicloud.io/v1beta1 8 | kind: Logging 9 | metadata: 10 | name: containerd 11 | spec: 12 | enableDockerParserCompatibilityForCRI: true 13 | fluentd: {} 14 | controlNamespace: default 15 | fluentbit: {} 16 | --- 17 | apiVersion: logging.banzaicloud.io/v1beta1 18 | kind: Flow 19 | metadata: 20 | name: all 21 | spec: 22 | filters: 23 | # for debugging 24 | - stdout: {} 25 | # With `enableDockerParserCompatibilityForCRI: true` key and key_name are 26 | # set to "log" otherwise these are set to "message" if the runtime is CRI 27 | #- concat: 28 | # key: log 29 | #- parser: 30 | # key_name: log 31 | match: 32 | - select: {} 33 | localOutputRefs: 34 | - "null" 35 | --- 36 | apiVersion: logging.banzaicloud.io/v1beta1 37 | kind: Output 38 | metadata: 39 | name: "null" 40 | spec: 41 | nullout: {} 42 | -------------------------------------------------------------------------------- /config/samples/extensions/logging-extensions_v1alpha1_eventtailer_with_pvc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging-extensions.banzaicloud.io/v1alpha1 2 | kind: EventTailer 3 | metadata: 4 | name: sample-w-pvc 5 | spec: 6 | # Add fields here 7 | controlNamespace: default 8 | workloadOverrides: 9 | priorityClassName: system-node-critical 10 | positionVolume: 11 | pvc: 12 | spec: 13 | accessModes: 14 | - ReadWriteOnce 15 | resources: 16 | requests: 17 | storage: 1Gi 18 | volumeMode: Filesystem 19 | -------------------------------------------------------------------------------- /config/samples/extensions/logging-extensions_v1alpha1_eventtailer_without_pvc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging-extensions.banzaicloud.io/v1alpha1 2 | kind: EventTailer 3 | metadata: 4 | name: sample-wo-pvc 5 | spec: 6 | # Add fields here 7 | controlNamespace: default 8 | workloadOverrides: 9 | priorityClassName: system-cluster-critical -------------------------------------------------------------------------------- /config/samples/extensions/logging-extensions_v1alpha1_hosttailer.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging-extensions.banzaicloud.io/v1alpha1 2 | kind: HostTailer 3 | metadata: 4 | name: sample 5 | spec: 6 | # Add fields here 7 | enableRecreateWorkloadOnImmutableFieldChange: false 8 | workloadOverrides: 9 | priorityClassName: system-node-critical 10 | fileTailers: 11 | - name: firstfiletailer 12 | path: /dev/urandom 13 | disabled: true 14 | - name: secondfiletailer 15 | path: /tmp/foobar 16 | disabled: true 17 | - name: thirdfiletailer 18 | path: /tmp/temp/foobar 19 | disabled: false 20 | - name: fourthfiletailer 21 | path: /tmp/temp/shifter 22 | disabled: false 23 | systemdTailers: 24 | - name: firstsystemdtailer 25 | disabled: false 26 | maxEntries: 20 27 | systemdFilter: kubelet.service -------------------------------------------------------------------------------- /config/samples/extensions/logging-extensions_v1alpha1_webhook.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: admissionregistration.k8s.io/v1beta1 2 | kind: MutatingWebhookConfiguration 3 | metadata: 4 | name: sample-webhook-cfg 5 | labels: 6 | app: sample-webhook 7 | annotations: 8 | certmanager.k8s.io/inject-ca-from: "namespace/certificate-name" 9 | webhooks: 10 | - name: sample-webhook.banzaicloud.com 11 | clientConfig: 12 | service: 13 | name: sample-tailer-webhook 14 | namespace: default 15 | path: "/tailer-webhook" 16 | caBundle: "-- your CARoot comes here --" 17 | rules: 18 | - operations: [ "CREATE" ] 19 | apiGroups: [""] 20 | apiVersions: ["v1"] 21 | resources: ["pods"] 22 | scope: "*" 23 | # namespaceSelector: 24 | # matchLabels: 25 | # sidecar-injector: enabled 26 | -------------------------------------------------------------------------------- /config/samples/extensions/testpod.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: test-pd 5 | spec: 6 | containers: 7 | - image: nginx 8 | name: test-container 9 | volumeMounts: 10 | - mountPath: /test 11 | name: test-volume 12 | - mountPath: /var/log/nginx 13 | name: nginx 14 | volumes: 15 | - name: test-volume 16 | hostPath: 17 | # directory location on host 18 | path: /tmp 19 | - name: nginx 20 | hostPath: 21 | path: /var/log/nginx -------------------------------------------------------------------------------- /config/samples/extensions/testpod_annotated.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: test-pod 5 | annotations: {"sidecar.logging-extensions.banzaicloud.io/tail": "/tmp/zzz,/tmp/foo/bar"} 6 | spec: 7 | containers: 8 | - image: nginx 9 | name: test-container 10 | volumeMounts: 11 | - mountPath: /test 12 | name: test-volume 13 | volumes: 14 | - name: test-volume 15 | hostPath: 16 | # directory location on host 17 | path: /tmp -------------------------------------------------------------------------------- /config/samples/extensions/testpod_annotated_multicontainer.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: test-multipod 5 | annotations: {"sidecar.logging-extensions.banzaicloud.io/tail": "test-container:/var/log/nginx/access.log,test-container:/var/log/nginx/error.log,second-container:/var/log/date,/var/log/foo/shifter"} 6 | spec: 7 | containers: 8 | - image: nginx 9 | name: test-container 10 | - image: debian 11 | name: second-container 12 | command: ["/bin/sh", "-c"] 13 | args: 14 | - while true; do 15 | date >> /var/log/date; 16 | sleep 1; 17 | done 18 | volumes: 19 | - name: test-volume 20 | hostPath: 21 | path: /tmp -------------------------------------------------------------------------------- /config/samples/fluentbit-multi.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: multi 5 | spec: 6 | fluentd: {} 7 | # # the legacy fluentbit spec should now be used separately 8 | # fluentbit: 9 | # positiondb: 10 | # hostPath: 11 | # path: "" 12 | # bufferStorageVolume: 13 | # hostPath: 14 | # path: "" 15 | controlNamespace: default 16 | --- 17 | apiVersion: logging.banzaicloud.io/v1beta1 18 | kind: FluentbitAgent 19 | metadata: 20 | # in a migration scenario it is important to use the same name as the logging resource in order to keep the same buffers and position volume names (if the defaults are used as in the example) 21 | name: multi 22 | spec: 23 | positiondb: 24 | hostPath: 25 | path: "" 26 | bufferStorageVolume: 27 | hostPath: 28 | path: "" 29 | --- 30 | apiVersion: logging.banzaicloud.io/v1beta1 31 | kind: FluentbitAgent 32 | metadata: 33 | name: multi-2 34 | spec: 35 | positiondb: 36 | hostPath: 37 | path: "" 38 | bufferStorageVolume: 39 | hostPath: 40 | path: "" 41 | --- 42 | apiVersion: logging.banzaicloud.io/v1beta1 43 | kind: Flow 44 | metadata: 45 | name: all 46 | spec: 47 | filters: 48 | - stdout: {} 49 | match: 50 | - select: {} 51 | localOutputRefs: 52 | - "null" 53 | --- 54 | apiVersion: logging.banzaicloud.io/v1beta1 55 | kind: Output 56 | metadata: 57 | name: "null" 58 | spec: 59 | nullout: {} 60 | -------------------------------------------------------------------------------- /config/samples/fluentdconfig.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: logging 5 | --- 6 | apiVersion: logging.banzaicloud.io/v1beta1 7 | kind: Logging 8 | metadata: 9 | name: fluentd-config 10 | spec: 11 | controlNamespace: logging 12 | --- 13 | apiVersion: logging.banzaicloud.io/v1beta1 14 | kind: FluentdConfig 15 | metadata: 16 | name: fluentd-config 17 | namespace: logging 18 | spec: {} 19 | -------------------------------------------------------------------------------- /config/samples/logging_logging_fluentd_sidecars.yaml: -------------------------------------------------------------------------------- 1 | # example config for using sidecar containers in fluentd pods 2 | --- 3 | apiVersion: logging.banzaicloud.io/v1beta1 4 | kind: Logging 5 | metadata: 6 | name: logging-fluentd-sidecars 7 | spec: 8 | controlNamespace: kube-logging 9 | fluentd: 10 | sidecarContainers: 11 | - command: 12 | - sleep 13 | - infinity 14 | image: alpine 15 | name: fluentdsidecar 16 | -------------------------------------------------------------------------------- /config/samples/logging_logging_watchNamespaceSelector.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: logging.banzaicloud.io/v1beta1 2 | kind: Logging 3 | metadata: 4 | name: defaultlogging 5 | spec: 6 | fluentd: 7 | disablePvc: true 8 | fluentbit: {} 9 | controlNamespace: default 10 | watchNamespaceSelector: 11 | matchLabels: 12 | a: b 13 | -------------------------------------------------------------------------------- /config/samples/logging_logging_with_monitoring.yaml: -------------------------------------------------------------------------------- 1 | # example config to activate monitoring, 2 | # required to use logging dashboard 3 | # depends on https://github.com/prometheus-operator/prometheus-operator 4 | --- 5 | apiVersion: logging.banzaicloud.io/v1beta1 6 | kind: Logging 7 | metadata: 8 | name: logging-example 9 | spec: 10 | controlNamespace: kube-logging 11 | enableRecreateWorkloadOnImmutableFieldChange: true 12 | fluentd: 13 | bufferVolumeImage: 14 | repository: ghcr.io/kube-logging/logging-operator/node-exporter 15 | bufferVolumeMetrics: 16 | prometheusRules: true 17 | serviceMonitor: true 18 | metrics: 19 | prometheusRules: true 20 | serviceMonitor: true 21 | fluentbit: 22 | metrics: 23 | prometheusRules: true 24 | serviceMonitor: true 25 | bufferStorage: 26 | storage.metrics: "On" 27 | healthCheck: 28 | hcErrorsCount: 15 29 | hcPeriod: 60 30 | hcRetryFailureCount: 5 31 | --- 32 | apiVersion: logging.banzaicloud.io/v1beta1 33 | kind: FluentbitAgent 34 | metadata: 35 | name: logging-example 36 | spec: 37 | metrics: 38 | prometheusRules: true 39 | serviceMonitor: true 40 | -------------------------------------------------------------------------------- /config/samples/mulitenant-hard/logging/receiver-infra.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: infra 5 | --- 6 | apiVersion: v1 7 | kind: Service 8 | metadata: 9 | name: test-receiver 10 | namespace: infra 11 | spec: 12 | type: ClusterIP 13 | ports: 14 | - port: 8080 15 | targetPort: receiver 16 | protocol: TCP 17 | name: receiver 18 | selector: 19 | app.kubernetes.io/name: test-receiver 20 | --- 21 | apiVersion: apps/v1 22 | kind: Deployment 23 | metadata: 24 | name: test-receiver 25 | namespace: infra 26 | spec: 27 | selector: 28 | matchLabels: 29 | app.kubernetes.io/name: test-receiver 30 | template: 31 | metadata: 32 | labels: 33 | app.kubernetes.io/name: test-receiver 34 | annotations: 35 | fluentbit.io/exclude: "true" 36 | spec: 37 | containers: 38 | - name: fluentbit 39 | image: fluent/fluent-bit 40 | args: ["-i", "http", "-p", "port=8080", "-o", "stdout"] 41 | ports: 42 | - name: receiver 43 | containerPort: 8080 44 | -------------------------------------------------------------------------------- /config/samples/mulitenant-hard/logging/tenant-a-logging.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: a-control 5 | --- 6 | apiVersion: logging.banzaicloud.io/v1beta1 7 | kind: Logging 8 | metadata: 9 | name: a 10 | spec: 11 | loggingRef: a 12 | fluentd: 13 | nodeSelector: 14 | tenant: tenant-a 15 | controlNamespace: a-control 16 | watchNamespaceSelector: 17 | matchLabels: 18 | tenant: tenant-a 19 | --- 20 | apiVersion: logging.banzaicloud.io/v1beta1 21 | kind: FluentbitAgent 22 | metadata: 23 | name: a 24 | spec: 25 | loggingRef: a 26 | nodeSelector: 27 | tenant: tenant-a 28 | -------------------------------------------------------------------------------- /config/samples/mulitenant-hard/logging/tenant-a-user.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: a 5 | labels: 6 | tenant: tenant-a 7 | --- 8 | apiVersion: logging.banzaicloud.io/v1beta1 9 | kind: Flow 10 | metadata: 11 | name: all 12 | namespace: a 13 | spec: 14 | loggingRef: a 15 | match: 16 | - select: 17 | labels: 18 | app.kubernetes.io/name: log-generator 19 | localOutputRefs: 20 | - http 21 | --- 22 | apiVersion: logging.banzaicloud.io/v1beta1 23 | kind: Output 24 | metadata: 25 | name: http 26 | namespace: a 27 | spec: 28 | loggingRef: a 29 | http: 30 | endpoint: http://test-receiver.infra:8080/tenant-a 31 | content_type: application/json 32 | buffer: 33 | type: memory 34 | timekey: 1s 35 | timekey_wait: 0s 36 | -------------------------------------------------------------------------------- /config/samples/mulitenant-hard/logging/tenant-b-logging.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: b-control 5 | --- 6 | apiVersion: logging.banzaicloud.io/v1beta1 7 | kind: Logging 8 | metadata: 9 | name: b 10 | spec: 11 | loggingRef: b 12 | fluentd: 13 | nodeSelector: 14 | tenant: tenant-b 15 | controlNamespace: b-control 16 | watchNamespaceSelector: 17 | matchLabels: 18 | tenant: tenant-b 19 | --- 20 | apiVersion: logging.banzaicloud.io/v1beta1 21 | kind: FluentbitAgent 22 | metadata: 23 | name: b 24 | spec: 25 | loggingRef: b 26 | nodeSelector: 27 | tenant: tenant-b 28 | -------------------------------------------------------------------------------- /config/samples/mulitenant-hard/logging/tenant-b-user.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: b 5 | labels: 6 | tenant: tenant-b 7 | --- 8 | apiVersion: logging.banzaicloud.io/v1beta1 9 | kind: Flow 10 | metadata: 11 | name: all 12 | namespace: b 13 | spec: 14 | loggingRef: b 15 | match: 16 | - select: 17 | labels: 18 | app.kubernetes.io/name: log-generator 19 | localOutputRefs: 20 | - http 21 | --- 22 | apiVersion: logging.banzaicloud.io/v1beta1 23 | kind: Output 24 | metadata: 25 | name: http 26 | namespace: b 27 | spec: 28 | loggingRef: b 29 | http: 30 | endpoint: http://test-receiver.infra:8080/tenant-b 31 | content_type: application/json 32 | buffer: 33 | type: memory 34 | timekey: 1s 35 | timekey_wait: 0s 36 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing-2/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | make generate install 3 | kubectl apply -f config/samples/multitenant-routing-2/logging 4 | helm upgrade --install --namespace a log-generator oci://ghcr.io/kube-logging/helm-charts/log-generator 5 | helm upgrade --install --namespace b1 log-generator oci://ghcr.io/kube-logging/helm-charts/log-generator 6 | helm upgrade --install --namespace b2 log-generator oci://ghcr.io/kube-logging/helm-charts/log-generator 7 | helm upgrade --install --namespace c log-generator oci://ghcr.io/kube-logging/helm-charts/log-generator 8 | # in a separate shell 9 | make run 10 | ``` 11 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing-2/logging/tenant-a-logging.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: a-control 5 | --- 6 | apiVersion: logging.banzaicloud.io/v1beta1 7 | kind: Logging 8 | metadata: 9 | name: a 10 | labels: 11 | tenant: a 12 | spec: 13 | loggingRef: a 14 | fluentd: {} 15 | controlNamespace: a-control 16 | watchNamespaces: 17 | - a 18 | --- 19 | apiVersion: logging.banzaicloud.io/v1beta1 20 | kind: ClusterOutput 21 | metadata: 22 | name: http 23 | namespace: a-control 24 | spec: 25 | loggingRef: a 26 | http: 27 | endpoint: http://test-receiver.infra:8080/tenant-a 28 | content_type: application/json 29 | buffer: 30 | type: memory 31 | timekey: 1s 32 | timekey_wait: 0s 33 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing-2/logging/tenant-a-user.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: a 5 | --- 6 | apiVersion: logging.banzaicloud.io/v1beta1 7 | kind: Flow 8 | metadata: 9 | name: all 10 | namespace: a 11 | spec: 12 | loggingRef: a 13 | match: 14 | - select: 15 | labels: 16 | app.kubernetes.io/name: log-generator 17 | globalOutputRefs: 18 | - http 19 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing-2/logging/tenant-b-logging.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: b-control 5 | --- 6 | apiVersion: logging.banzaicloud.io/v1beta1 7 | kind: Logging 8 | metadata: 9 | name: b 10 | labels: 11 | tenant: b 12 | spec: 13 | loggingRef: b 14 | syslogNG: 15 | jsonKeyDelim: '#' 16 | globalOptions: 17 | stats: 18 | level: 2 19 | freq: 0 20 | controlNamespace: b-control 21 | watchNamespaces: 22 | - b1 23 | - b2 24 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing-2/logging/tenant-b-user1.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: b1 5 | --- 6 | apiVersion: logging.banzaicloud.io/v1beta1 7 | kind: SyslogNGFlow 8 | metadata: 9 | name: log-generator 10 | namespace: b1 11 | spec: 12 | loggingRef: b 13 | match: 14 | regexp: 15 | pattern: log-generator 16 | type: string 17 | value: json#kubernetes#labels#app.kubernetes.io/name 18 | localOutputRefs: 19 | - http 20 | --- 21 | apiVersion: logging.banzaicloud.io/v1beta1 22 | kind: SyslogNGOutput 23 | metadata: 24 | name: http 25 | namespace: b1 26 | spec: 27 | loggingRef: b 28 | http: 29 | url: http://test-receiver.infra:8080/tenant-b-namespace-b1 30 | headers: 31 | - "Content-type: application/json" 32 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing-2/logging/tenant-b-user2.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: b2 5 | --- 6 | apiVersion: logging.banzaicloud.io/v1beta1 7 | kind: SyslogNGFlow 8 | metadata: 9 | name: log-generator 10 | namespace: b2 11 | spec: 12 | loggingRef: b 13 | match: 14 | regexp: 15 | pattern: log-generator 16 | type: string 17 | value: json#kubernetes#labels#app.kubernetes.io/name 18 | localOutputRefs: 19 | - http 20 | --- 21 | apiVersion: logging.banzaicloud.io/v1beta1 22 | kind: SyslogNGOutput 23 | metadata: 24 | name: http 25 | namespace: b2 26 | spec: 27 | loggingRef: b 28 | http: 29 | url: http://test-receiver.infra:8080/tenant-b-namespace-b2 30 | headers: 31 | - "Content-type: application/json" 32 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing-2/logging/tenant-c-logging.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: c-control 5 | --- 6 | apiVersion: logging.banzaicloud.io/v1beta1 7 | kind: Logging 8 | metadata: 9 | name: c 10 | labels: 11 | tenant: c 12 | spec: 13 | loggingRef: c 14 | fluentd: {} 15 | controlNamespace: c-control 16 | watchNamespaces: 17 | - c 18 | --- 19 | apiVersion: logging.banzaicloud.io/v1beta1 20 | kind: ClusterOutput 21 | metadata: 22 | name: http 23 | namespace: c-control 24 | spec: 25 | loggingRef: c 26 | http: 27 | endpoint: http://test-receiver.infra:8080/tenant-c 28 | content_type: application/json 29 | buffer: 30 | type: memory 31 | timekey: 1s 32 | timekey_wait: 0s 33 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing-2/logging/tenant-c-user.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: c 5 | --- 6 | apiVersion: logging.banzaicloud.io/v1beta1 7 | kind: Flow 8 | metadata: 9 | name: all 10 | namespace: c 11 | spec: 12 | loggingRef: c 13 | match: 14 | - select: 15 | labels: 16 | app.kubernetes.io/name: log-generator 17 | globalOutputRefs: 18 | - http 19 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing-2/logging/tenant-infra-logging.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: infra 5 | --- 6 | apiVersion: logging.banzaicloud.io/v1beta1 7 | kind: Logging 8 | metadata: 9 | name: infra 10 | labels: 11 | tenant: infra 12 | spec: 13 | loggingRef: infra 14 | fluentd: {} 15 | controlNamespace: infra 16 | --- 17 | apiVersion: logging.banzaicloud.io/v1beta1 18 | kind: Flow 19 | metadata: 20 | name: all 21 | namespace: infra 22 | spec: 23 | loggingRef: a 24 | match: 25 | - select: {} 26 | filters: 27 | - stdout: {} 28 | --- 29 | apiVersion: logging.banzaicloud.io/v1beta1 30 | kind: FluentbitAgent 31 | metadata: 32 | name: infra 33 | spec: 34 | loggingRef: infra 35 | inputTail: 36 | storage.type: filesystem 37 | positiondb: 38 | hostPath: 39 | path: "" 40 | bufferStorageVolume: 41 | hostPath: 42 | path: "" 43 | network: 44 | connectTimeout: 2 45 | --- 46 | apiVersion: logging.banzaicloud.io/v1beta1 47 | kind: LoggingRoute 48 | metadata: 49 | name: tenants 50 | spec: 51 | source: infra 52 | targets: 53 | matchExpressions: 54 | - key: tenant 55 | operator: Exists 56 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing-2/logging/tenant-infra-receiver.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: test-receiver 5 | namespace: infra 6 | spec: 7 | type: ClusterIP 8 | ports: 9 | - port: 8080 10 | targetPort: receiver 11 | protocol: TCP 12 | name: receiver 13 | selector: 14 | app.kubernetes.io/name: test-receiver 15 | --- 16 | apiVersion: apps/v1 17 | kind: Deployment 18 | metadata: 19 | name: test-receiver 20 | namespace: infra 21 | spec: 22 | selector: 23 | matchLabels: 24 | app.kubernetes.io/name: test-receiver 25 | template: 26 | metadata: 27 | labels: 28 | app.kubernetes.io/name: test-receiver 29 | annotations: 30 | fluentbit.io/exclude: "true" 31 | spec: 32 | containers: 33 | - name: fluentbit 34 | image: fluent/fluent-bit 35 | args: ["-i", "http", "-p", "port=8080", "-o", "stdout"] 36 | ports: 37 | - name: receiver 38 | containerPort: 8080 39 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing-tc/tc-simple/collector.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: collector 5 | --- 6 | apiVersion: telemetry.kube-logging.dev/v1alpha1 7 | kind: Collector 8 | metadata: 9 | name: cluster 10 | spec: 11 | controlNamespace: collector 12 | tenantSelector: 13 | matchLabels: 14 | collector: cluster 15 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing-tc/tc-simple/tenant-a.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: customer-a 5 | labels: 6 | tenant: customer-a 7 | --- 8 | apiVersion: telemetry.kube-logging.dev/v1alpha1 9 | kind: Tenant 10 | metadata: 11 | name: customer-a 12 | labels: 13 | collector: cluster 14 | spec: 15 | logSourceNamespaceSelectors: 16 | - matchLabels: 17 | tenant: customer-a 18 | subscriptionNamespaceSelectors: 19 | - matchLabels: 20 | tenant: customer-a 21 | --- 22 | apiVersion: telemetry.kube-logging.dev/v1alpha1 23 | kind: Subscription 24 | metadata: 25 | name: customer-a 26 | namespace: customer-a 27 | labels: 28 | tenant: customer-a 29 | spec: 30 | condition: "true" 31 | outputs: 32 | - name: customer-a-receiver 33 | namespace: customer-a 34 | --- 35 | apiVersion: telemetry.kube-logging.dev/v1alpha1 36 | kind: Output 37 | metadata: 38 | name: customer-a-receiver 39 | namespace: customer-a 40 | spec: 41 | otlp: 42 | endpoint: receiver-a-collector.customer-a.svc.cluster.local:4317 43 | tls: 44 | insecure: true 45 | --- 46 | apiVersion: opentelemetry.io/v1alpha1 47 | kind: OpenTelemetryCollector 48 | metadata: 49 | name: receiver-a 50 | namespace: customer-a 51 | spec: 52 | managementState: managed 53 | config: | 54 | receivers: 55 | otlp: 56 | protocols: 57 | grpc: 58 | 59 | exporters: 60 | debug: 61 | verbosity: detailed 62 | service: 63 | pipelines: 64 | logs: 65 | receivers: [otlp] 66 | exporters: [debug] 67 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing-tc/tc-simple/tenant-b.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: customer-b 5 | labels: 6 | tenant: customer-b 7 | --- 8 | apiVersion: telemetry.kube-logging.dev/v1alpha1 9 | kind: Tenant 10 | metadata: 11 | name: customer-b 12 | labels: 13 | collector: cluster 14 | spec: 15 | logSourceNamespaceSelectors: 16 | - matchLabels: 17 | tenant: customer-b 18 | subscriptionNamespaceSelectors: 19 | - matchLabels: 20 | tenant: customer-b 21 | --- 22 | apiVersion: telemetry.kube-logging.dev/v1alpha1 23 | kind: Subscription 24 | metadata: 25 | name: customer-b 26 | namespace: customer-b 27 | labels: 28 | tenant: customer-b 29 | spec: 30 | condition: "true" 31 | outputs: 32 | - name: customer-b-receiver 33 | namespace: customer-b 34 | --- 35 | apiVersion: telemetry.kube-logging.dev/v1alpha1 36 | kind: Output 37 | metadata: 38 | name: customer-b-receiver 39 | namespace: customer-b 40 | spec: 41 | otlp: 42 | endpoint: receiver-b-collector.customer-b.svc.cluster.local:4317 43 | tls: 44 | insecure: true 45 | --- 46 | apiVersion: opentelemetry.io/v1alpha1 47 | kind: OpenTelemetryCollector 48 | metadata: 49 | name: receiver-b 50 | namespace: customer-b 51 | spec: 52 | managementState: managed 53 | config: | 54 | receivers: 55 | otlp: 56 | protocols: 57 | grpc: 58 | 59 | exporters: 60 | debug: 61 | verbosity: detailed 62 | service: 63 | pipelines: 64 | logs: 65 | receivers: [otlp] 66 | exporters: [debug] 67 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing-tc/tc-simple/tenant-infra.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: infra 5 | labels: 6 | tenant: infra 7 | --- 8 | apiVersion: telemetry.kube-logging.dev/v1alpha1 9 | kind: Tenant 10 | metadata: 11 | name: infra 12 | labels: 13 | collector: cluster 14 | spec: 15 | logSourceNamespaceSelectors: 16 | - matchExpressions: 17 | - key: tenant 18 | operator: Exists 19 | subscriptionNamespaceSelectors: 20 | - matchLabels: 21 | tenant: infra 22 | --- 23 | apiVersion: telemetry.kube-logging.dev/v1alpha1 24 | kind: Subscription 25 | metadata: 26 | name: infra 27 | namespace: infra 28 | labels: 29 | tenant: infra 30 | spec: 31 | condition: "true" 32 | outputs: 33 | - name: infra-all 34 | namespace: infra 35 | --- 36 | apiVersion: telemetry.kube-logging.dev/v1alpha1 37 | kind: Output 38 | metadata: 39 | name: infra-all 40 | namespace: infra 41 | spec: 42 | otlp: 43 | endpoint: receiver-infra-collector.infra.svc.cluster.local:4317 44 | tls: 45 | insecure: true 46 | --- 47 | apiVersion: opentelemetry.io/v1alpha1 48 | kind: OpenTelemetryCollector 49 | metadata: 50 | name: receiver-infra 51 | namespace: infra 52 | spec: 53 | managementState: managed 54 | config: | 55 | receivers: 56 | otlp: 57 | protocols: 58 | grpc: 59 | 60 | exporters: 61 | debug: 62 | verbosity: detailed 63 | service: 64 | pipelines: 65 | logs: 66 | receivers: [otlp] 67 | exporters: [debug] 68 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | make generate install 3 | kubectl apply -f config/samples/multitenant-routing/logging 4 | helm upgrade --install --namespace customer-a log-generator oci://ghcr.io/kube-logging/helm-charts/log-generator 5 | helm upgrade --install --namespace customer-b log-generator oci://ghcr.io/kube-logging/helm-charts/log-generator 6 | # in a separate shell 7 | make run 8 | ``` 9 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing/logging/tenant-a-logging.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: customer-a 5 | labels: 6 | tenant: customer-a 7 | --- 8 | apiVersion: v1 9 | kind: Namespace 10 | metadata: 11 | name: customer-a-infra 12 | --- 13 | apiVersion: logging.banzaicloud.io/v1beta1 14 | kind: Logging 15 | metadata: 16 | name: customer-a 17 | labels: 18 | tenant: customer-a 19 | spec: 20 | fluentd: {} 21 | controlNamespace: customer-a-infra 22 | watchNamespaceSelector: 23 | matchLabels: 24 | tenant: customer-a 25 | --- 26 | apiVersion: logging.banzaicloud.io/v1beta1 27 | kind: Output 28 | metadata: 29 | name: http 30 | namespace: customer-a 31 | spec: 32 | http: 33 | endpoint: http://test-receiver.infra:8080/customer-a 34 | content_type: application/json 35 | buffer: 36 | type: memory 37 | timekey: 1s 38 | timekey_wait: 0s 39 | --- 40 | apiVersion: logging.banzaicloud.io/v1beta1 41 | kind: Flow 42 | metadata: 43 | name: log-generator 44 | namespace: customer-a 45 | spec: 46 | match: 47 | - select: 48 | labels: 49 | app.kubernetes.io/name: log-generator 50 | localOutputRefs: 51 | - http 52 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing/logging/tenant-b-logging.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: customer-b 5 | labels: 6 | tenant: customer-b 7 | --- 8 | apiVersion: v1 9 | kind: Namespace 10 | metadata: 11 | name: customer-b-infra 12 | --- 13 | apiVersion: logging.banzaicloud.io/v1beta1 14 | kind: Logging 15 | metadata: 16 | name: customer-b 17 | labels: 18 | tenant: customer-b 19 | spec: 20 | fluentd: {} 21 | controlNamespace: customer-b-infra 22 | watchNamespaceSelector: 23 | matchLabels: 24 | tenant: customer-b 25 | --- 26 | apiVersion: logging.banzaicloud.io/v1beta1 27 | kind: Output 28 | metadata: 29 | name: http 30 | namespace: customer-b 31 | spec: 32 | http: 33 | endpoint: http://test-receiver.infra:8080/customer-b 34 | content_type: application/json 35 | buffer: 36 | type: memory 37 | timekey: 1s 38 | timekey_wait: 0s 39 | --- 40 | apiVersion: logging.banzaicloud.io/v1beta1 41 | kind: Flow 42 | metadata: 43 | name: log-generator 44 | namespace: customer-b 45 | spec: 46 | match: 47 | - select: 48 | labels: 49 | app.kubernetes.io/name: log-generator 50 | localOutputRefs: 51 | - http 52 | -------------------------------------------------------------------------------- /config/samples/multitenant-routing/logging/tenant-infra-receiver.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: test-receiver 5 | namespace: infra 6 | spec: 7 | type: ClusterIP 8 | ports: 9 | - port: 8080 10 | targetPort: receiver 11 | protocol: TCP 12 | name: receiver 13 | selector: 14 | app.kubernetes.io/name: test-receiver 15 | --- 16 | apiVersion: apps/v1 17 | kind: Deployment 18 | metadata: 19 | name: test-receiver 20 | namespace: infra 21 | spec: 22 | selector: 23 | matchLabels: 24 | app.kubernetes.io/name: test-receiver 25 | template: 26 | metadata: 27 | labels: 28 | app.kubernetes.io/name: test-receiver 29 | annotations: 30 | fluentbit.io/exclude: "true" 31 | spec: 32 | containers: 33 | - name: fluentbit 34 | image: fluent/fluent-bit 35 | args: ["-i", "http", "-p", "port=8080", "-o", "stdout"] 36 | ports: 37 | - name: receiver 38 | containerPort: 8080 39 | -------------------------------------------------------------------------------- /config/samples/syslog-ng-custom-metrics.yaml: -------------------------------------------------------------------------------- 1 | kind: Logging 2 | apiVersion: logging.banzaicloud.io/v1beta1 3 | metadata: 4 | name: logging 5 | spec: 6 | controlNamespace: default 7 | fluentbit: {} 8 | syslogNG: 9 | metrics: {} 10 | sourceMetrics: 11 | - key: custom_input 12 | --- 13 | apiVersion: logging.banzaicloud.io/v1beta1 14 | kind: SyslogNGFlow 15 | metadata: 16 | name: all1 17 | spec: 18 | match: {} 19 | outputMetrics: 20 | - key: custom_output 21 | labels: 22 | # destination, output_name, output_namespace, output_scope (local/global) and logging are automatically populated 23 | # 24 | # set any of the above to empty if it needs to be left out completely: 25 | # destination: "" 26 | # 27 | # value can be a go template which can access .Destination.Name, .Destination.Namespace. .Destination.Scope, .Destination.Logging: 28 | # destination: "{{ .Destination.Name }}" 29 | flow: all1 30 | output_namespace: "" 31 | localOutputRefs: 32 | - http 33 | globalOutputRefs: 34 | - http2 35 | --- 36 | apiVersion: logging.banzaicloud.io/v1beta1 37 | kind: SyslogNGClusterFlow 38 | metadata: 39 | name: all2 40 | spec: 41 | match: {} 42 | outputMetrics: 43 | - key: custom_output 44 | labels: 45 | flow: all2 46 | globalOutputRefs: 47 | - http2 48 | --- 49 | apiVersion: logging.banzaicloud.io/v1beta1 50 | kind: SyslogNGOutput 51 | metadata: 52 | name: http 53 | spec: 54 | file: 55 | path: "/tmp/log" 56 | --- 57 | apiVersion: logging.banzaicloud.io/v1beta1 58 | kind: SyslogNGClusterOutput 59 | metadata: 60 | name: http2 61 | spec: 62 | file: 63 | path: "/tmp/log" 64 | -------------------------------------------------------------------------------- /config/samples/syslog-ng-otlp/manifests.yaml: -------------------------------------------------------------------------------- 1 | kind: Logging 2 | apiVersion: logging.banzaicloud.io/v1beta1 3 | metadata: 4 | name: logging 5 | spec: 6 | controlNamespace: default 7 | fluentbit: {} 8 | syslogNG: {} 9 | --- 10 | apiVersion: logging.banzaicloud.io/v1beta1 11 | kind: SyslogNGFlow 12 | metadata: 13 | name: all 14 | namespace: log-generator 15 | spec: 16 | match: {} 17 | localOutputRefs: 18 | - otlp 19 | --- 20 | apiVersion: logging.banzaicloud.io/v1beta1 21 | kind: SyslogNGOutput 22 | metadata: 23 | name: otlp 24 | namespace: log-generator 25 | spec: 26 | opentelemetry: 27 | url: otel-collector:4317 28 | auth: 29 | insecure: {} 30 | -------------------------------------------------------------------------------- /config/samples/syslog-ng-otlp/opentelemetry.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: otel-collector-config 6 | data: 7 | config.yaml: |- 8 | receivers: 9 | otlp: 10 | protocols: 11 | grpc: 12 | endpoint: 0.0.0.0:4317 13 | exporters: 14 | debug: 15 | verbosity: detailed 16 | service: 17 | pipelines: 18 | logs/debug: 19 | receivers: [otlp] 20 | exporters: [debug] 21 | --- 22 | apiVersion: apps/v1 23 | kind: Deployment 24 | metadata: 25 | name: otel-collector 26 | spec: 27 | selector: 28 | matchLabels: 29 | app: opentelemetry 30 | component: otel-collector 31 | template: 32 | metadata: 33 | labels: 34 | app: opentelemetry 35 | component: otel-collector 36 | spec: 37 | containers: 38 | - name: otel-collector 39 | image: otel/opentelemetry-collector-contrib:0.104.0 40 | volumeMounts: 41 | - mountPath: /etc/otelcol-contrib 42 | name: data 43 | readOnly: true 44 | volumes: 45 | - name: data 46 | configMap: 47 | name: otel-collector-config 48 | 49 | --- 50 | apiVersion: v1 51 | kind: Service 52 | metadata: 53 | name: otel-collector 54 | labels: 55 | app: opentelemetry 56 | component: otel-collector 57 | spec: 58 | ports: 59 | - name: otlp 60 | port: 4317 61 | selector: 62 | component: otel-collector 63 | -------------------------------------------------------------------------------- /config/samples/syslog-ng-pvc-metrics.yaml: -------------------------------------------------------------------------------- 1 | kind: Logging 2 | apiVersion: logging.banzaicloud.io/v1beta1 3 | metadata: 4 | name: logging 5 | spec: 6 | controlNamespace: default 7 | syslogNG: 8 | bufferVolumeMetrics: 9 | mount_name: buffers 10 | # prometheus chart or the operator should be installed for this to work 11 | serviceMonitor: true 12 | statefulSet: 13 | spec: 14 | template: 15 | spec: 16 | containers: 17 | - name: syslog-ng 18 | volumeMounts: 19 | - mountPath: /buffers 20 | name: buffers 21 | volumeClaimTemplates: 22 | - metadata: 23 | name: buffers 24 | spec: 25 | accessModes: 26 | - ReadWriteOnce 27 | resources: 28 | requests: 29 | storage: 3Gi 30 | --- 31 | apiVersion: logging.banzaicloud.io/v1beta1 32 | kind: SyslogNGFlow 33 | metadata: 34 | name: all1 35 | spec: 36 | match: {} 37 | localOutputRefs: 38 | - http 39 | - http2 40 | --- 41 | apiVersion: logging.banzaicloud.io/v1beta1 42 | kind: SyslogNGFlow 43 | metadata: 44 | name: all2 45 | spec: 46 | match: {} 47 | localOutputRefs: 48 | - http 49 | - http2 50 | --- 51 | apiVersion: logging.banzaicloud.io/v1beta1 52 | kind: SyslogNGOutput 53 | metadata: 54 | name: http 55 | spec: 56 | file: 57 | path: "/tmp/log" 58 | --- 59 | apiVersion: logging.banzaicloud.io/v1beta1 60 | kind: SyslogNGOutput 61 | metadata: 62 | name: http2 63 | spec: 64 | file: 65 | path: "/tmp/log" 66 | -------------------------------------------------------------------------------- /config/samples/syslog-ng-retry.yaml: -------------------------------------------------------------------------------- 1 | kind: Logging 2 | apiVersion: logging.banzaicloud.io/v1beta1 3 | metadata: 4 | name: logging 5 | spec: 6 | controlNamespace: default 7 | fluentbit: 8 | # The below network configurations allow fluentbit to retry indefinitely on a limited number of connections 9 | # to avoid overloading the aggregator (syslog-ng in this case) 10 | network: 11 | maxWorkerConnections: 2 12 | syslogng_output: 13 | Workers: 2 14 | Retry_Limit: "no_limits" 15 | syslogNG: 16 | # globalOptions: 17 | # log_level: trace 18 | statefulSet: 19 | spec: 20 | template: 21 | spec: 22 | containers: 23 | - name: syslog-ng 24 | resources: 25 | limits: 26 | cpu: 50m 27 | requests: 28 | cpu: 50m 29 | --- 30 | apiVersion: logging.banzaicloud.io/v1beta1 31 | kind: SyslogNGFlow 32 | metadata: 33 | name: all1 34 | spec: 35 | match: {} 36 | localOutputRefs: 37 | - http 38 | - http2 39 | --- 40 | apiVersion: logging.banzaicloud.io/v1beta1 41 | kind: SyslogNGFlow 42 | metadata: 43 | name: all2 44 | spec: 45 | match: {} 46 | localOutputRefs: 47 | - http 48 | - http2 49 | --- 50 | apiVersion: logging.banzaicloud.io/v1beta1 51 | kind: SyslogNGOutput 52 | metadata: 53 | name: http 54 | spec: 55 | file: 56 | path: "/tmp/log" 57 | --- 58 | apiVersion: logging.banzaicloud.io/v1beta1 59 | kind: SyslogNGOutput 60 | metadata: 61 | name: http2 62 | spec: 63 | file: 64 | path: "/tmp/log" 65 | -------------------------------------------------------------------------------- /config/samples/syslog-ng-simple.yaml: -------------------------------------------------------------------------------- 1 | kind: Logging 2 | apiVersion: logging.banzaicloud.io/v1beta1 3 | metadata: 4 | name: logging 5 | spec: 6 | controlNamespace: default 7 | fluentbit: {} 8 | syslogNG: {} 9 | --- 10 | apiVersion: logging.banzaicloud.io/v1beta1 11 | kind: SyslogNGFlow 12 | metadata: 13 | name: all1 14 | spec: 15 | match: {} 16 | localOutputRefs: 17 | - http 18 | - http2 19 | --- 20 | apiVersion: logging.banzaicloud.io/v1beta1 21 | kind: SyslogNGFlow 22 | metadata: 23 | name: all2 24 | spec: 25 | match: {} 26 | localOutputRefs: 27 | - http 28 | - http2 29 | --- 30 | apiVersion: logging.banzaicloud.io/v1beta1 31 | kind: SyslogNGOutput 32 | metadata: 33 | name: http 34 | spec: 35 | file: 36 | path: "/tmp/log" 37 | --- 38 | apiVersion: logging.banzaicloud.io/v1beta1 39 | kind: SyslogNGOutput 40 | metadata: 41 | name: http2 42 | spec: 43 | file: 44 | path: "/tmp/log" 45 | -------------------------------------------------------------------------------- /config/samples/telemetry-controller-routing/tc-tenant-a-logging.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: customer-a 5 | labels: 6 | tenant: customer-a 7 | --- 8 | apiVersion: v1 9 | kind: Namespace 10 | metadata: 11 | name: customer-a-infra 12 | --- 13 | apiVersion: logging.banzaicloud.io/v1beta1 14 | kind: Logging 15 | metadata: 16 | name: customer-a 17 | labels: 18 | tenant: customer-a 19 | spec: 20 | fluentd: 21 | disablePvc: true 22 | logLevel: trace 23 | controlNamespace: customer-a-infra 24 | watchNamespaceSelector: 25 | matchLabels: 26 | tenant: customer-a 27 | routeConfig: 28 | enableTelemetryControllerRoute: false 29 | disableLoggingRoute: false 30 | tenantLabels: 31 | tenant: customer-a 32 | --- 33 | apiVersion: logging.banzaicloud.io/v1beta1 34 | kind: Flow 35 | metadata: 36 | name: all 37 | namespace: customer-a 38 | spec: 39 | match: 40 | - select: 41 | labels: 42 | app.kubernetes.io/name: log-generator 43 | localOutputRefs: 44 | - http-a 45 | --- 46 | apiVersion: logging.banzaicloud.io/v1beta1 47 | kind: Output 48 | metadata: 49 | name: http-a 50 | namespace: customer-a 51 | spec: 52 | http: 53 | endpoint: http://logging-operator-test-receiver.logging:8080/customer-a 54 | content_type: application/json 55 | buffer: 56 | type: memory 57 | tags: time 58 | timekey: 1s 59 | timekey_wait: 0s 60 | -------------------------------------------------------------------------------- /config/samples/telemetry-controller-routing/tc-tenant-b-logging.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: customer-b 5 | labels: 6 | tenant: customer-b 7 | --- 8 | apiVersion: v1 9 | kind: Namespace 10 | metadata: 11 | name: customer-b-infra 12 | --- 13 | apiVersion: logging.banzaicloud.io/v1beta1 14 | kind: Logging 15 | metadata: 16 | name: customer-b 17 | labels: 18 | tenant: customer-b 19 | spec: 20 | fluentd: 21 | disablePvc: true 22 | logLevel: trace 23 | controlNamespace: customer-b-infra 24 | watchNamespaceSelector: 25 | matchLabels: 26 | tenant: customer-b 27 | routeConfig: 28 | enableTelemetryControllerRoute: true 29 | disableLoggingRoute: true 30 | tenantLabels: 31 | tenant: customer-b 32 | --- 33 | apiVersion: logging.banzaicloud.io/v1beta1 34 | kind: Flow 35 | metadata: 36 | name: all 37 | namespace: customer-b 38 | spec: 39 | match: 40 | - select: 41 | labels: 42 | app.kubernetes.io/name: log-generator 43 | localOutputRefs: 44 | - http-b 45 | --- 46 | apiVersion: logging.banzaicloud.io/v1beta1 47 | kind: Output 48 | metadata: 49 | name: http-b 50 | namespace: customer-b 51 | spec: 52 | http: 53 | endpoint: http://logging-operator-test-receiver.logging:8080/customer-b 54 | content_type: application/json 55 | buffer: 56 | type: memory 57 | tags: time 58 | timekey: 1s 59 | timekey_wait: 0s 60 | -------------------------------------------------------------------------------- /config/samples/telemetry-controller-routing/tc-tenant-infra-receiver.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: test-receiver 5 | namespace: infra 6 | spec: 7 | type: ClusterIP 8 | ports: 9 | - port: 8080 10 | targetPort: receiver 11 | protocol: TCP 12 | name: receiver 13 | selector: 14 | app.kubernetes.io/name: test-receiver 15 | --- 16 | apiVersion: apps/v1 17 | kind: Deployment 18 | metadata: 19 | name: test-receiver 20 | namespace: infra 21 | spec: 22 | selector: 23 | matchLabels: 24 | app.kubernetes.io/name: test-receiver 25 | template: 26 | metadata: 27 | labels: 28 | app.kubernetes.io/name: test-receiver 29 | annotations: 30 | fluentbit.io/exclude: "true" 31 | spec: 32 | containers: 33 | - name: fluentbit 34 | image: fluent/fluent-bit 35 | args: ["-i", "http", "-p", "port=8080", "-o", "stdout"] 36 | ports: 37 | - name: receiver 38 | containerPort: 8080 39 | -------------------------------------------------------------------------------- /config/webhook/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - manifests.yaml 3 | - service.yaml 4 | 5 | configurations: 6 | - kustomizeconfig.yaml 7 | -------------------------------------------------------------------------------- /config/webhook/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # the following config is for teaching kustomize where to look at when substituting vars. 2 | # It requires kustomize v2.1.0 or newer to work properly. 3 | nameReference: 4 | - kind: Service 5 | version: v1 6 | fieldSpecs: 7 | - kind: MutatingWebhookConfiguration 8 | group: admissionregistration.k8s.io 9 | path: webhooks/clientConfig/service/name 10 | - kind: ValidatingWebhookConfiguration 11 | group: admissionregistration.k8s.io 12 | path: webhooks/clientConfig/service/name 13 | 14 | namespace: 15 | - kind: MutatingWebhookConfiguration 16 | group: admissionregistration.k8s.io 17 | path: webhooks/clientConfig/service/namespace 18 | create: true 19 | - kind: ValidatingWebhookConfiguration 20 | group: admissionregistration.k8s.io 21 | path: webhooks/clientConfig/service/namespace 22 | create: true 23 | 24 | varReference: 25 | - path: metadata/annotations 26 | -------------------------------------------------------------------------------- /config/webhook/service.yaml: -------------------------------------------------------------------------------- 1 | 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: webhook-service 6 | namespace: system 7 | spec: 8 | ports: 9 | - port: 443 10 | targetPort: 443 11 | selector: 12 | control-plane: controller-manager 13 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | ### Contents 2 | 3 | This folder contains two major class of documents: 4 | - technical documentation snippets of various features around the operator 5 | - generated documentation from code under the [configuration](./configuration) folder 6 | 7 | End user documentation is available under https://kube-logging.dev 8 | -------------------------------------------------------------------------------- /docs/configuration/crds/extensions/v1alpha1/filetailer.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kube-logging/logging-operator/1f642a8b20c7bb6ced66c7611b296a19b620358e/docs/configuration/crds/extensions/v1alpha1/filetailer.md -------------------------------------------------------------------------------- /docs/configuration/crds/extensions/v1alpha1/systemdtailer.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kube-logging/logging-operator/1f642a8b20c7bb6ced66c7611b296a19b620358e/docs/configuration/crds/extensions/v1alpha1/systemdtailer.md -------------------------------------------------------------------------------- /docs/configuration/crds/v1beta1/clusteroutput_types.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: ClusterOutput 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | ## ClusterOutput 8 | 9 | ClusterOutput is the Schema for the clusteroutputs API 10 | 11 | ### (metav1.TypeMeta, required) {#clusteroutput-} 12 | 13 | 14 | ### metadata (metav1.ObjectMeta, optional) {#clusteroutput-metadata} 15 | 16 | 17 | ### spec (ClusterOutputSpec, required) {#clusteroutput-spec} 18 | 19 | 20 | ### status (OutputStatus, optional) {#clusteroutput-status} 21 | 22 | 23 | 24 | ## ClusterOutputSpec 25 | 26 | ClusterOutputSpec contains Kubernetes spec for ClusterOutput 27 | 28 | ### (OutputSpec, required) {#clusteroutputspec-} 29 | 30 | 31 | ### protected (bool, optional) {#clusteroutputspec-protected} 32 | 33 | 34 | 35 | ## ClusterOutputList 36 | 37 | ClusterOutputList contains a list of ClusterOutput 38 | 39 | ### (metav1.TypeMeta, required) {#clusteroutputlist-} 40 | 41 | 42 | ### metadata (metav1.ListMeta, optional) {#clusteroutputlist-metadata} 43 | 44 | 45 | ### items ([]ClusterOutput, required) {#clusteroutputlist-items} 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/configuration/crds/v1beta1/conversion.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kube-logging/logging-operator/1f642a8b20c7bb6ced66c7611b296a19b620358e/docs/configuration/crds/v1beta1/conversion.md -------------------------------------------------------------------------------- /docs/configuration/crds/v1beta1/fluentd_config_types.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: FluentdConfig 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | ## FluentdConfig 8 | 9 | ### (metav1.TypeMeta, required) {#fluentdconfig-} 10 | 11 | 12 | ### metadata (metav1.ObjectMeta, optional) {#fluentdconfig-metadata} 13 | 14 | 15 | ### spec (FluentdSpec, optional) {#fluentdconfig-spec} 16 | 17 | 18 | ### status (FluentdConfigStatus, optional) {#fluentdconfig-status} 19 | 20 | 21 | 22 | ## FluentdConfigStatus 23 | 24 | ### active (*bool, optional) {#fluentdconfigstatus-active} 25 | 26 | 27 | ### logging (string, optional) {#fluentdconfigstatus-logging} 28 | 29 | 30 | ### problems ([]string, optional) {#fluentdconfigstatus-problems} 31 | 32 | 33 | ### problemsCount (int, optional) {#fluentdconfigstatus-problemscount} 34 | 35 | 36 | 37 | ## FluentdConfigList 38 | 39 | ### (metav1.TypeMeta, required) {#fluentdconfiglist-} 40 | 41 | 42 | ### metadata (metav1.ListMeta, optional) {#fluentdconfiglist-metadata} 43 | 44 | 45 | ### items ([]FluentdConfig, required) {#fluentdconfiglist-items} 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/configuration/crds/v1beta1/syslogng_clusteroutput_types.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SyslogNGClusterOutput 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | ## SyslogNGClusterOutput 8 | 9 | SyslogNGClusterOutput is the Schema for the syslog-ng clusteroutputs API 10 | 11 | ### (metav1.TypeMeta, required) {#syslogngclusteroutput-} 12 | 13 | 14 | ### metadata (metav1.ObjectMeta, optional) {#syslogngclusteroutput-metadata} 15 | 16 | 17 | ### spec (SyslogNGClusterOutputSpec, required) {#syslogngclusteroutput-spec} 18 | 19 | 20 | ### status (SyslogNGOutputStatus, optional) {#syslogngclusteroutput-status} 21 | 22 | 23 | 24 | ## SyslogNGClusterOutputSpec 25 | 26 | SyslogNGClusterOutputSpec contains Kubernetes spec for SyslogNGClusterOutput 27 | 28 | ### (SyslogNGOutputSpec, required) {#syslogngclusteroutputspec-} 29 | 30 | 31 | ### protected (bool, optional) {#syslogngclusteroutputspec-protected} 32 | 33 | 34 | 35 | ## SyslogNGClusterOutputList 36 | 37 | SyslogNGClusterOutputList contains a list of SyslogNGClusterOutput 38 | 39 | ### (metav1.TypeMeta, required) {#syslogngclusteroutputlist-} 40 | 41 | 42 | ### metadata (metav1.ListMeta, optional) {#syslogngclusteroutputlist-metadata} 43 | 44 | 45 | ### items ([]SyslogNGClusterOutput, required) {#syslogngclusteroutputlist-items} 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/configuration/crds/v1beta1/syslogng_config_types.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SyslogNGConfig 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | ## SyslogNGConfig 8 | 9 | ### (metav1.TypeMeta, required) {#syslogngconfig-} 10 | 11 | 12 | ### metadata (metav1.ObjectMeta, optional) {#syslogngconfig-metadata} 13 | 14 | 15 | ### spec (SyslogNGSpec, optional) {#syslogngconfig-spec} 16 | 17 | 18 | ### status (SyslogNGConfigStatus, optional) {#syslogngconfig-status} 19 | 20 | 21 | 22 | ## SyslogNGConfigStatus 23 | 24 | ### active (*bool, optional) {#syslogngconfigstatus-active} 25 | 26 | 27 | ### logging (string, optional) {#syslogngconfigstatus-logging} 28 | 29 | 30 | ### problems ([]string, optional) {#syslogngconfigstatus-problems} 31 | 32 | 33 | ### problemsCount (int, optional) {#syslogngconfigstatus-problemscount} 34 | 35 | 36 | 37 | ## SyslogNGConfigList 38 | 39 | ### (metav1.TypeMeta, required) {#syslogngconfiglist-} 40 | 41 | 42 | ### metadata (metav1.ListMeta, optional) {#syslogngconfiglist-metadata} 43 | 44 | 45 | ### items ([]SyslogNGConfig, required) {#syslogngconfiglist-items} 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/configuration/plugins/common/security.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Security 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | ## Security 8 | 9 | ### allow_anonymous_source (bool, optional) {#security-allow_anonymous_source} 10 | 11 | Allow anonymous source. sections are required if disabled. 12 | 13 | 14 | ### self_hostname (string, required) {#security-self_hostname} 15 | 16 | Hostname 17 | 18 | 19 | ### shared_key (string, required) {#security-shared_key} 20 | 21 | Shared key for authentication. 22 | 23 | 24 | ### user_auth (bool, optional) {#security-user_auth} 25 | 26 | If true, use user based authentication. 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /docs/configuration/plugins/filters/dedot.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Dedot 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | # [Dedot Filter](https://github.com/lunardial/fluent-plugin-dedot_filter) 8 | ## Overview 9 | Fluentd Filter plugin to de-dot field name for elasticsearch. 10 | 11 | ## Configuration 12 | ## DedotFilterConfig 13 | 14 | ### de_dot_nested (bool, optional) {#dedotfilterconfig-de_dot_nested} 15 | 16 | Will cause the plugin to recourse through nested structures (hashes and arrays), and remove dots in those key-names too. 17 | 18 | Default: false 19 | 20 | ### de_dot_separator (string, optional) {#dedotfilterconfig-de_dot_separator} 21 | 22 | Separator 23 | 24 | Default: _ 25 | 26 | 27 | 28 | 29 | ## Example `Dedot` filter configurations 30 | 31 | {{< highlight yaml >}} 32 | apiVersion: logging.banzaicloud.io/v1beta1 33 | kind: Flow 34 | metadata: 35 | name: demo-flow 36 | spec: 37 | filters: 38 | - dedot: 39 | de_dot_separator: "-" 40 | de_dot_nested: true 41 | selectors: {} 42 | localOutputRefs: 43 | - demo-output 44 | {{}} 45 | 46 | Fluentd config result: 47 | 48 | {{< highlight xml >}} 49 | 50 | @type dedot 51 | @id test_dedot 52 | de_dot_nested true 53 | de_dot_separator - 54 | 55 | {{}} 56 | 57 | 58 | --- 59 | -------------------------------------------------------------------------------- /docs/configuration/plugins/filters/kube_events_timestamp.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Kubernetes Events Timestamp 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | # [Kubernetes Events Timestamp Filter](https://github.com/kube-logging/fluentd-filter-kube-events-timestamp) 8 | ## Overview 9 | Fluentd Filter plugin to select particular timestamp into an additional field 10 | 11 | ## Configuration 12 | ## KubeEventsTimestampConfig 13 | 14 | ### mapped_time_key (string, optional) {#kubeeventstimestampconfig-mapped_time_key} 15 | 16 | Added time field name 17 | 18 | Default: triggerts 19 | 20 | ### timestamp_fields ([]string, optional) {#kubeeventstimestampconfig-timestamp_fields} 21 | 22 | Time field names in order of relevance 23 | 24 | Default: event.eventTime, event.lastTimestamp, event.firstTimestamp 25 | 26 | 27 | 28 | 29 | ## Example `Kubernetes Events Timestamp` filter configurations 30 | 31 | {{< highlight yaml >}} 32 | apiVersion: logging.banzaicloud.io/v1beta1 33 | kind: Flow 34 | metadata: 35 | name: es-flow 36 | spec: 37 | filters: 38 | - kube_events_timestamp: 39 | timestamp_fields: 40 | - "event.eventTime" 41 | - "event.lastTimestamp" 42 | - "event.firstTimestamp" 43 | mapped_time_key: mytimefield 44 | selectors: {} 45 | localOutputRefs: 46 | - es-output 47 | {{}} 48 | 49 | Fluentd config result: 50 | 51 | {{< highlight xml >}} 52 | 53 | @type kube_events_timestamp 54 | @id test-kube-events-timestamp 55 | timestamp_fields ["event.eventTime","event.lastTimestamp","event.firstTimestamp"] 56 | mapped_time_key mytimefield 57 | 58 | {{}} 59 | 60 | 61 | --- 62 | -------------------------------------------------------------------------------- /docs/configuration/plugins/filters/stdout.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: StdOut 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | # [Stdout Filter](https://docs.fluentd.org/filter/stdout) 8 | ## Overview 9 | Fluentd Filter plugin to print events to stdout 10 | 11 | ## Configuration 12 | ## StdOutFilterConfig 13 | 14 | ### output_type (string, optional) {#stdoutfilterconfig-output_type} 15 | 16 | This is the option of stdout format. 17 | 18 | 19 | 20 | 21 | 22 | ## Example `StdOut` filter configurations 23 | 24 | {{< highlight yaml >}} 25 | apiVersion: logging.banzaicloud.io/v1beta1 26 | kind: Flow 27 | metadata: 28 | name: demo-flow 29 | spec: 30 | filters: 31 | - stdout: 32 | output_type: json 33 | selectors: {} 34 | localOutputRefs: 35 | - demo-output 36 | {{}} 37 | 38 | Fluentd config result: 39 | 40 | {{< highlight yaml >}} 41 | 42 | @type stdout 43 | @id test_stdout 44 | output_type json 45 | 46 | {{}} 47 | 48 | 49 | --- 50 | -------------------------------------------------------------------------------- /docs/configuration/plugins/filters/useragent.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: User Agent 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | # Fluentd UserAgent filter 8 | ## Overview 9 | Fluentd Filter plugin to parse user-agent 10 | More information at https://github.com/bungoume/fluent-plugin-ua-parser 11 | 12 | ## Configuration 13 | ## UserAgent 14 | 15 | ### delete_key (bool, optional) {#useragent-delete_key} 16 | 17 | Delete input key 18 | 19 | Default: false 20 | 21 | ### flatten (bool, optional) {#useragent-flatten} 22 | 23 | Join hashed data by '_' 24 | 25 | Default: false 26 | 27 | ### key_name (string, optional) {#useragent-key_name} 28 | 29 | Target key name 30 | 31 | Default: user_agent 32 | 33 | ### out_key (string, optional) {#useragent-out_key} 34 | 35 | Output prefix key name 36 | 37 | Default: ua 38 | 39 | 40 | 41 | 42 | ## Example `UserAgent` filter configurations 43 | 44 | {{< highlight yaml >}} 45 | apiVersion: logging.banzaicloud.io/v1beta1 46 | kind: Flow 47 | metadata: 48 | name: demo-flow 49 | spec: 50 | filters: 51 | - useragent: 52 | key_name: my_agent 53 | delete_key: true 54 | out_key: ua_fields 55 | flatten: true 56 | selectors: {} 57 | localOutputRefs: 58 | - demo-output 59 | {{}} 60 | 61 | Fluentd config result: 62 | 63 | {{< highlight xml >}} 64 | 65 | @type ua_parser 66 | @id test_useragent 67 | key_name my_agent 68 | delete_key true 69 | out_key ua_fields 70 | flatten true 71 | 72 | {{}} 73 | 74 | 75 | --- 76 | -------------------------------------------------------------------------------- /docs/configuration/plugins/outputs/format.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Format 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | # Format output records 8 | ## Overview 9 | 10 | Specify how to format output records. For details, see [https://docs.fluentd.org/configuration/format-section](https://docs.fluentd.org/configuration/format-section). 11 | 12 | ## Example 13 | 14 | ```yaml 15 | spec: 16 | format: 17 | path: /tmp/logs/${tag}/%Y/%m/%d.%H.%M 18 | format: 19 | type: single_value 20 | add_newline: true 21 | message_key: msg 22 | ``` 23 | 24 | 25 | ## Configuration 26 | ## Format 27 | 28 | ### add_newline (*bool, optional) {#format-add_newline} 29 | 30 | When type is single_value add '\n' to the end of the message 31 | 32 | Default: true 33 | 34 | ### message_key (string, optional) {#format-message_key} 35 | 36 | When type is single_value specify the key holding information 37 | 38 | 39 | ### type (string, optional) {#format-type} 40 | 41 | Output line formatting: out_file,json,ltsv,csv,msgpack,hash,single_value 42 | 43 | Default: json 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/configuration/plugins/outputs/format_rfc5424.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Format rfc5424 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | ## FormatRfc5424 8 | 9 | ### app_name_field (string, optional) {#formatrfc5424-app_name_field} 10 | 11 | Sets app name in syslog from field in fluentd, delimited by '.' 12 | 13 | Default: app_name 14 | 15 | ### hostname_field (string, optional) {#formatrfc5424-hostname_field} 16 | 17 | Sets host name in syslog from field in fluentd, delimited by '.' 18 | 19 | Default: hostname 20 | 21 | ### log_field (string, optional) {#formatrfc5424-log_field} 22 | 23 | Sets log in syslog from field in fluentd, delimited by '.' 24 | 25 | Default: log 26 | 27 | ### message_id_field (string, optional) {#formatrfc5424-message_id_field} 28 | 29 | Sets msg id in syslog from field in fluentd, delimited by '.' 30 | 31 | Default: message_id 32 | 33 | ### proc_id_field (string, optional) {#formatrfc5424-proc_id_field} 34 | 35 | Sets proc id in syslog from field in fluentd, delimited by '.' 36 | 37 | Default: proc_id 38 | 39 | ### rfc6587_message_size (*bool, optional) {#formatrfc5424-rfc6587_message_size} 40 | 41 | Prepends message length for syslog transmission 42 | 43 | Default: true 44 | 45 | ### structured_data_field (string, optional) {#formatrfc5424-structured_data_field} 46 | 47 | Sets structured data in syslog from field in fluentd, delimited by '.' (default structured_data) 48 | 49 | 50 | ### type (string, optional) {#formatrfc5424-type} 51 | 52 | Output line formatting: out_file,json,ltsv,csv,msgpack,hash,single_value 53 | 54 | Default: json 55 | 56 | 57 | -------------------------------------------------------------------------------- /docs/configuration/plugins/outputs/newrelic.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: NewRelic 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | # New Relic Logs plugin for Fluentd 8 | ## Overview 9 | 10 | Output plugin send log data to New Relic Logs 11 | 12 | ## Example output configurations 13 | 14 | ```yaml 15 | spec: 16 | newrelic: 17 | license_key: 18 | valueFrom: 19 | secretKeyRef: 20 | name: logging-newrelic 21 | key: licenseKey 22 | ``` 23 | 24 | 25 | ## Configuration 26 | ## Output Config 27 | 28 | ### api_key (*secret.Secret, optional) {#output config-api_key} 29 | 30 | New Relic API Insert key [Secret](../secret/) 31 | 32 | 33 | ### base_uri (string, optional) {#output config-base_uri} 34 | 35 | New Relic ingestion endpoint [Secret](../secret/) 36 | 37 | Default: https://log-api.newrelic.com/log/v1 38 | 39 | ### buffer (*Buffer, optional) {#output config-buffer} 40 | 41 | [Buffer](../buffer/) 42 | 43 | 44 | ### format (*Format, optional) {#output config-format} 45 | 46 | [Format](../format/) 47 | 48 | 49 | ### license_key (*secret.Secret, optional) {#output config-license_key} 50 | 51 | New Relic License Key (recommended) [Secret](../secret/" LicenseKey *secret.Secret `json:"license_key)` 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /docs/configuration/plugins/outputs/null.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Null 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | # Null output plugin for Fluentd 8 | ## Overview 9 | 10 | 11 | For details, see [https://docs.fluentd.org/output/null](https://docs.fluentd.org/output/null). 12 | 13 | ## Example output configurations 14 | 15 | ```yaml 16 | spec: 17 | nullout: 18 | never_flush: false 19 | ``` 20 | 21 | 22 | ## Configuration 23 | ## NullOutputConfig 24 | 25 | ### never_flush (*bool, optional) {#nulloutputconfig-never_flush} 26 | 27 | The parameter for testing to simulate the output plugin that never succeeds to flush. 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/configuration/plugins/syslogng-outputs/elasticsearch_datastream.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Elasticsearch datastream 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | # Sending messages over Elasticsearch datastreams 8 | ## Overview 9 | 10 | Based on the [ElasticSearch datastream destination of AxoSyslog core](https://axoflow.com/docs/axosyslog-core/chapter-destinations/configuring-destinations-elasticsearch-datastream/). 11 | 12 | ## Example 13 | 14 | {{< highlight yaml >}} 15 | apiVersion: logging.banzaicloud.io/v1beta1 16 | kind: SyslogNGOutput 17 | metadata: 18 | name: elasticsearc-hdatastream 19 | spec: 20 | elasticsearch-datastream: 21 | url: "https://elastic-endpoint:9200/my-data-stream/_bulk" 22 | user: "username" 23 | password: 24 | valueFrom: 25 | secretKeyRef: 26 | name: elastic 27 | key: password 28 | {{}} 29 | 30 | 31 | ## Configuration 32 | ## ElasticsearchDatastreamOutput 33 | 34 | ### (HTTPOutput, required) {#elasticsearchdatastreamoutput-} 35 | 36 | 37 | ### disk_buffer (*DiskBuffer, optional) {#elasticsearchdatastreamoutput-disk_buffer} 38 | 39 | This option enables putting outgoing messages into the disk buffer of the destination to avoid message loss in case of a system failure on the destination side. For details, see the [Syslog-ng DiskBuffer options](../disk_buffer/). 40 | 41 | Default: false 42 | 43 | ### record (string, optional) {#elasticsearchdatastreamoutput-record} 44 | 45 | Arguments to the `$format-json()` template function. Default: `"--scope rfc5424 --exclude DATE --key ISODATE @timestamp=${ISODATE}"` 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/configuration/plugins/syslogng-outputs/loggly.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Loggly output 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | # Loggly output plugin for syslog-ng 8 | ## Overview 9 | 10 | The `loggly()` destination sends log messages to the [Loggly](https://www.loggly.com/) Logging-as-a-Service provider. 11 | You can send log messages over TCP, or encrypted with [TLS for syslog-ng outputs](/docs/configuration/plugins/syslog-ng-outputs/tls/). 12 | 13 | For details on the available options of the output, see the [documentation of the AxoSyslog syslog-ng distribution](https://axoflow.com/docs/axosyslog-core/chapter-destinations/configuring-destinations-loggly/). 14 | 15 | ## Prerequisites 16 | 17 | You need a Loggly account and your user token to use this output. 18 | 19 | 20 | ## Configuration 21 | ## Loggly 22 | 23 | Documentation: https://github.com/syslog-ng/syslog-ng/blob/master/scl/loggly/loggly.conf 24 | 25 | ### (SyslogOutput, required) {#loggly-} 26 | 27 | syslog output configuration 28 | 29 | 30 | ### host (string, optional) {#loggly-host} 31 | 32 | Address of the destination host. 33 | 34 | 35 | ### tag (string, optional) {#loggly-tag} 36 | 37 | Event tag. For details, see the [Loggy documentation](https://documentation.solarwinds.com/en/success_center/loggly/content/admin/tags.htm) 38 | 39 | 40 | ### token (*secret.Secret, required) {#loggly-token} 41 | 42 | Your Customer Token that you received from Loggly. For details, see the [documentation of the AxoSyslog syslog-ng distribution](https://axoflow.com/docs/axosyslog-core/chapter-destinations/configuring-destinations-loggly/) 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/configuration/plugins/syslogng/outputs/loggly.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Loggly output 3 | weight: 200 4 | generated_file: true 5 | --- 6 | 7 | # Loggly output plugin for syslog-ng 8 | ## Overview 9 | More info at https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.37/administration-guide/43#TOPIC-1829072 10 | 11 | ## Configuration 12 | ## Loggly 13 | 14 | ### host (string, optional) {#loggly-host} 15 | 16 | Address of the destination host 17 | 18 | Default: - 19 | 20 | ### tag (string, optional) {#loggly-tag} 21 | 22 | Event tag [more information](https://documentation.solarwinds.com/en/success_center/loggly/content/admin/tags.htm) 23 | 24 | Default: - 25 | 26 | ### token (*secret.Secret, required) {#loggly-token} 27 | 28 | Your Customer Token that you received from Loggly [more information](https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.37/administration-guide/43#loggly-option-token) 29 | 30 | Default: - 31 | 32 | ### (SyslogOutput, required) {#loggly-} 33 | 34 | syslog output configuration 35 | 36 | Default: - 37 | 38 | 39 | -------------------------------------------------------------------------------- /docs/fluentbit-config-reload.md: -------------------------------------------------------------------------------- 1 | ## Fluent Bit config reload 2 | 3 | It is now possible to configure Fluent Bit to reload its configuration on the fly. 4 | 5 | This behaviour is disabled by default, but can be enabled with a single configuration option under 6 | the Logging's `spec.fluentbit.configHotReload` (legacy method) or the new FluentbitAgent's `spec.configHotReload`: 7 | 8 | ``` 9 | apiVersion: logging.banzaicloud.io/v1beta1 10 | kind: FluentbitAgent 11 | metadata: 12 | name: reload-example 13 | spec: 14 | configHotReload: {} 15 | ``` 16 | 17 | Currently `resources` and `image` is configurable: 18 | ``` 19 | apiVersion: logging.banzaicloud.io/v1beta1 20 | kind: FluentbitAgent 21 | metadata: 22 | name: reload-example 23 | spec: 24 | configHotReload: 25 | resources: ... 26 | image: 27 | repository: ghcr.io/kube-logging/config-reloader 28 | tag: v0.0.5 29 | ``` 30 | 31 | For all the available configuration options please check the [API docs](https://kube-logging.dev/docs/configuration/crds/v1beta1/fluentbit_types/) 32 | -------------------------------------------------------------------------------- /docs/syslog-ng-date-parser.md: -------------------------------------------------------------------------------- 1 | ## syslog-ng date parser 2 | 3 | By default, the syslog-ng aggregator uses the time when a message has been received on its input source as the timestamp. 4 | In case we want to use the timestamp written in the message metadata, we should use a [date-parser](https://axoflow.com/docs/axosyslog-core/chapter-parsers/date-parser/date-parser-options/). 5 | 6 | To enable the timestamps written by the container runtime (_cri_ or _docker_) and parsed by fluentbit automatically, we just 7 | have to define the `sourceDateParser` in the _syslog-ng_ spec. 8 | 9 | ``` 10 | kind: Logging 11 | metadata: 12 | name: example 13 | spec: 14 | syslogNG: 15 | sourceDateParser: {} 16 | ``` 17 | 18 | In case we want to define our own parser format and template we can also do so (these are the default values): 19 | 20 | ``` 21 | kind: Logging 22 | metadata: 23 | name: example 24 | spec: 25 | syslogNG: 26 | sourceDateParser: 27 | format: "%FT%T.%f%z" 28 | template: "${json.time}" 29 | ``` 30 | -------------------------------------------------------------------------------- /e2e/common/kind.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Cisco Systems, Inc. and/or its affiliates 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package common 16 | 17 | import ( 18 | "strings" 19 | 20 | "github.com/kube-logging/logging-operator/e2e/common/kind" 21 | ) 22 | 23 | const KindClusterCreationTimeout = "3m" 24 | 25 | func KindClusterKubeconfig(name string) ([]byte, error) { 26 | err := kind.CreateCluster(kind.CreateClusterOptions{ 27 | Name: name, 28 | Wait: KindClusterCreationTimeout, 29 | }) 30 | if err != nil && !isClusterAlreadyExistsError(err) { 31 | return nil, err 32 | } 33 | return kind.GetKubeconfig(kind.GetKubeconfigOptions{ 34 | Name: name, 35 | }) 36 | } 37 | 38 | func isClusterAlreadyExistsError(err error) bool { 39 | return strings.Contains(err.Error(), "failed to create cluster: node(s) already exist for a cluster with the name") 40 | } 41 | -------------------------------------------------------------------------------- /e2e/common/resources.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Cisco Systems, Inc. and/or its affiliates 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package common 16 | 17 | import "sigs.k8s.io/controller-runtime/pkg/client" 18 | 19 | func Resource(obj client.Object, ns, name string) client.Object { 20 | obj.SetName(name) 21 | obj.SetNamespace(ns) 22 | return obj 23 | } 24 | -------------------------------------------------------------------------------- /go.work: -------------------------------------------------------------------------------- 1 | go 1.24.1 2 | 3 | use ( 4 | . 5 | ./e2e 6 | ./images/config-reloader 7 | ./pkg/sdk 8 | ./pkg/sdk/logging/model/syslogng/config 9 | ) 10 | -------------------------------------------------------------------------------- /hack/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. -------------------------------------------------------------------------------- /hack/crds.annotations.snippet.txt: -------------------------------------------------------------------------------- 1 | {{- with .Values.annotations }} 2 | {{- toYaml . | nindent 4 }} 3 | {{- end }} 4 | -------------------------------------------------------------------------------- /hack/values.yaml: -------------------------------------------------------------------------------- 1 | nameOverride: e2e 2 | 3 | image: 4 | tag: local 5 | repository: controller 6 | 7 | testReceiver: 8 | enabled: true 9 | 10 | logging: 11 | enabled: true 12 | fluentd: 13 | image: 14 | repository: fluentd-full 15 | tag: local 16 | configReloaderImage: 17 | repository: config-reloader 18 | tag: local 19 | fluentbit: 20 | configHotReload: 21 | image: 22 | repository: config-reloader 23 | tag: local 24 | clusterFlows: 25 | - name: all 26 | spec: 27 | match: 28 | - select: {} 29 | globalOutputRefs: ["http"] 30 | clusterOutputs: 31 | - name: http 32 | spec: 33 | http: 34 | endpoint: http://e2e-test-receiver:8080/e2e.tag 35 | content_type: application/json 36 | buffer: 37 | type: memory 38 | timekey: 1s 39 | timekey_wait: 1s 40 | -------------------------------------------------------------------------------- /images/config-reloader/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.24.2-alpine3.20@sha256:00f149d5963f415a8a91943531b9092fde06b596b276281039604292d8b2b9c8 AS builder 2 | 3 | WORKDIR /workspace 4 | 5 | # Copy the Go Modules manifests 6 | COPY go.mod go.mod 7 | COPY go.sum go.sum 8 | COPY pkg pkg 9 | 10 | # cache deps before building and copying source so that we don't need to re-download as much 11 | # and so that source changes don't invalidate our downloaded layer 12 | RUN go mod download 13 | RUN go mod tidy 14 | 15 | # Copy the go source 16 | COPY /cmd/configreloader/main.go main.go 17 | 18 | # Build 19 | RUN CGO_ENABLED=0 go build -a -o config-reloader main.go 20 | 21 | # Use distroless as minimal base image to package the manager binary 22 | # Refer to https://github.com/GoogleContainerTools/distroless for more details 23 | FROM gcr.io/distroless/static:latest 24 | 25 | WORKDIR / 26 | 27 | COPY --from=builder /workspace/config-reloader . 28 | 29 | ENTRYPOINT ["/config-reloader"] 30 | -------------------------------------------------------------------------------- /images/config-reloader/cmd/configreloader/main.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2025 Kube logging authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package main 16 | 17 | import ( 18 | "log" 19 | 20 | "github.com/banzaicloud/config-reloader/pkg/configreloader" 21 | "github.com/banzaicloud/config-reloader/pkg/metrics" 22 | ) 23 | 24 | func main() { 25 | cfg, err := configreloader.New() 26 | if err != nil { 27 | log.Fatalln(err) 28 | } 29 | 30 | err = cfg.Run() 31 | if err != nil { 32 | log.Fatalln(err) 33 | } 34 | 35 | if !*cfg.InitMode { 36 | err = metrics.Run() 37 | if err != nil { 38 | log.Fatalln(err) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /images/config-reloader/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/banzaicloud/config-reloader 2 | 3 | go 1.24.1 4 | 5 | require ( 6 | github.com/fsnotify/fsnotify v1.9.0 7 | github.com/prometheus/client_golang v1.22.0 8 | ) 9 | 10 | require ( 11 | github.com/beorn7/perks v1.0.1 // indirect 12 | github.com/cespare/xxhash/v2 v2.3.0 // indirect 13 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect 14 | github.com/prometheus/client_model v0.6.1 // indirect 15 | github.com/prometheus/common v0.62.0 // indirect 16 | github.com/prometheus/procfs v0.15.1 // indirect 17 | golang.org/x/sys v0.30.0 // indirect 18 | google.golang.org/protobuf v1.36.5 // indirect 19 | ) 20 | -------------------------------------------------------------------------------- /images/fluentd-drain-watch/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.21.3@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c 2 | 3 | RUN apk add curl 4 | 5 | COPY drain-watch.sh /bin/drain-watch.sh 6 | 7 | ENTRYPOINT ["/bin/drain-watch.sh"] 8 | -------------------------------------------------------------------------------- /images/fluentd-drain-watch/README.md: -------------------------------------------------------------------------------- 1 | # Fluentd Drain Watch 2 | 3 | Fluentd Drain Watch is a monitoring script that ensures proper shutdown of Fluentd by waiting for its RPC endpoint to become available, monitoring buffer files, and terminating custom workers when no buffers remain. 4 | 5 | ## Features 6 | 7 | - Waits for Fluentd's RPC endpoint to be available before proceeding. 8 | - Monitors a custom-runner HTTP endpoint. 9 | - Ensures all buffer files are processed before exiting. 10 | - Triggers termination of custom workers upon completion. 11 | 12 | ## Usage 13 | 14 | Set required environment variables before running: 15 | 16 | ```sh 17 | export BUFFER_PATH=/path/to/buffers 18 | export CHECK_INTERVAL=60 # Optional, default is 60 seconds 19 | export RPC_ADDRESS=127.0.0.1:24444 # Optional, default is 127.0.0.1:24444 20 | export CUSTOM_RUNNER_ADDRESS=127.0.0.1:7357 # Optional, default is 127.0.0.1:7357 21 | ``` 22 | -------------------------------------------------------------------------------- /images/fluentd/README.md: -------------------------------------------------------------------------------- 1 | # [Fluentd](https://www.fluentd.org/) container images for the [Logging operator](https://github.com/kube-logging/logging-operator) 2 | 3 | You can find [Fluentd](https://www.fluentd.org/) container images to be used with the [Logging operator](https://github.com/kube-logging/logging-operator) in here. 4 | 5 | ## Usage 6 | 7 | Pick an image type (`filters` contains filter plugins only, `full` has output plugins as well). 8 | Image tags are constructed according to the following pattern: 9 | 10 | ```sh 11 | ghcr.io/kube-logging/logging-operator/fluentd:{LOGGING-OPERATOR-VERSION}-{IMAGE-TYPE} 12 | ``` 13 | 14 | ### Add new plugins 15 | 16 | If you wish to add a new plugin, use this image as a base image in your `Dockerfile`: 17 | 18 | ```dockerfile 19 | FROM ghcr.io/kube-logging/logging-operator/fluentd:{LOGGING-OPERATOR-VERSION}-{IMAGE-TYPE} 20 | ``` 21 | 22 | Then add your plugin: 23 | 24 | ```dockerfile 25 | RUN fluent-gem install PLUGIN_NAME -v PLUGIN_VERSION 26 | ``` 27 | 28 | ## Version Support Policy 29 | 30 | According to the Logging Operators release-cycle (6 weeks) we maintain the corresponding fluentd image version, which we support for the last 3 releases. 31 | 32 | ## Maintenance 33 | 34 | Whenever a new Fluentd version is released, check the supported versions and add/remove versions in this directory accordingly. 35 | 36 | Based on the supported Fluentd versions, you may drop old versions from the repository. 37 | 38 | The `Dockerfile` in this directory is not generated and it doesn't use build args to keep things simple. 39 | We may revisit that decision in the future. 40 | -------------------------------------------------------------------------------- /images/fluentd/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #source vars if file exists 4 | DEFAULT=/etc/default/fluentd 5 | 6 | if [ -r $DEFAULT ]; then 7 | set -o allexport 8 | . $DEFAULT 9 | set +o allexport 10 | fi 11 | 12 | # If the user has supplied only arguments append them to `fluentd` command 13 | if [ "${1#-}" != "$1" ]; then 14 | set -- fluentd "$@" 15 | fi 16 | 17 | # If user does not supply config file or plugins, use the default 18 | if [ "$1" = "fluentd" ]; then 19 | if ! echo $@ | grep ' \-c' ; then 20 | set -- "$@" -c /fluentd/etc/${FLUENTD_CONF} 21 | fi 22 | 23 | if ! echo $@ | grep ' \-p' ; then 24 | set -- "$@" -p /fluentd/plugins 25 | fi 26 | fi 27 | 28 | exec "$@" 29 | -------------------------------------------------------------------------------- /images/fluentd/filters/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://index.rubygems.org' 2 | 3 | gem 'fluent-plugin-detect-exceptions', '0.0.16' 4 | gem 'fluent-plugin-prometheus', '2.2.1' 5 | gem 'fluent-plugin-dedot_filter', '1.0.0' 6 | gem 'fluent-plugin-geoip', '1.3.2' 7 | gem 'fluent-plugin-tag-normaliser', '0.1.3' 8 | gem 'fluent-plugin-concat', '2.5.0' 9 | gem 'fluent-plugin-parser-logfmt', '0.0.0' 10 | gem 'fluent-plugin-record-modifier', '2.2.0' 11 | gem 'fluent-plugin-kube-events-timestamp', '0.1.3' 12 | gem 'fluent-plugin-throttle', '0.0.5' 13 | gem 'fluent-plugin-rewrite-tag-filter', '2.4.0' 14 | gem 'fluent-plugin-multi-format-parser', '1.1.0' 15 | gem 'fluent-plugin-grok-parser', '2.6.2' 16 | gem 'fluent-plugin-mysqlslowquery', '0.0.9' 17 | gem 'fluent-plugin-ua-parser', '1.2.0' 18 | -------------------------------------------------------------------------------- /images/fluentd/fluent.conf: -------------------------------------------------------------------------------- 1 | # This is the root config file, which only includes components of the actual configuration 2 | 3 | # Do not collect fluentd's own logs to avoid infinite loops. 4 | 5 | @type null 6 | 7 | 8 | @include /fluentd/etc/conf.d/*.conf 9 | -------------------------------------------------------------------------------- /images/fluentd/healthy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | 3 | # Liveness probe is aimed to help in situations where fluentd 4 | # silently hangs for no apparent reasons until manual restart. 5 | # The idea of this probe is that if fluentd is not queueing or 6 | # flushing chunks for 5 minutes, something is not right. If 7 | # you want to change the fluentd configuration, reducing amount of 8 | # logs fluentd collects, consider changing the threshold or turning 9 | # liveness probe off completely. 10 | # soiurce https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/fluentd-gcp/fluentd-gcp-ds.yaml#L58 11 | 12 | BUFFER_PATH=${BUFFER_PATH}; 13 | LIVENESS_THRESHOLD_SECONDS=${LIVENESS_THRESHOLD_SECONDS:-300}; 14 | 15 | if [ ! -e ${BUFFER_PATH} ]; 16 | then 17 | exit 1; 18 | fi; 19 | touch -d "@$(($(date +%s) - $LIVENESS_THRESHOLD_SECONDS))" /tmp/marker-liveness; 20 | if [ -z "$(find ${BUFFER_PATH} -type d -newer /tmp/marker-liveness -print -quit)" ]; 21 | then 22 | exit 1; 23 | fi; 24 | -------------------------------------------------------------------------------- /images/fluentd/outputs/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://index.rubygems.org' 2 | 3 | gem 'fluent-plugin-aliyun-oss', '0.0.1' 4 | gem 'fluent-plugin-kafka', '0.19.4' 5 | gem 'fluent-plugin-grafana-loki', '1.2.20' 6 | gem 'fluent-plugin-kinesis', '3.5.0' 7 | gem 'fluent-plugin-splunk-hec', '1.3.3' 8 | gem 'fluent-plugin-elasticsearch', '6.0.0' 9 | gem 'fluent-plugin-newrelic', '1.2.3' 10 | gem 'fluent-plugin-cloudwatch-logs', '0.14.3' 11 | gem 'fluent-plugin-opensearch', '1.1.5' 12 | gem 'fluent-plugin-logzio', '0.2.2' 13 | gem 'fluent-plugin-datadog', '0.14.4' 14 | gem 'fluent-plugin-redis', '0.3.5' 15 | gem 'fluent-plugin-sqs', '3.0.0' 16 | gem 'fluent-plugin-mattermost', '0.2.2' 17 | gem 'fluent-plugin-remote-syslog', '1.1.0' 18 | gem 'fluent-plugin-webhdfs', '1.6.0' 19 | gem 'fluent-plugin-vmware-loginsight', '1.4.2' 20 | gem 'fluent-plugin-vmware-log-intelligence', '2.0.8' 21 | gem 'fluent-plugin-gelf-best', '1.4.1' 22 | gem 'fluent-plugin-s3', '1.8.3' 23 | gem 'fluent-plugin-gcs', '0.4.4' 24 | gem 'rdkafka', '0.21.0' 25 | #gem 'fluent-plugin-aws-elasticsearch-service', '2.4.1' 26 | #gem 'fluent-plugin-logdna', '~> 0.4.0' 27 | -------------------------------------------------------------------------------- /images/node-exporter/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ghcr.io/kube-logging/custom-runner:v0.12.0 AS custom-runner 2 | 3 | FROM quay.io/prometheus/node-exporter:v1.9.1 4 | 5 | COPY --from=custom-runner /runner / 6 | 7 | USER root 8 | 9 | RUN mkdir -p /prometheus/node_exporter/textfile_collector 10 | 11 | COPY buffer-size.sh /prometheus/buffer-size.sh 12 | RUN chmod 0744 /prometheus/buffer-size.sh 13 | 14 | WORKDIR / 15 | 16 | ENTRYPOINT ["/runner"] 17 | -------------------------------------------------------------------------------- /images/node-exporter/README.md: -------------------------------------------------------------------------------- 1 | # Node Exporter Image 2 | 3 | Node Exporter Image is a monitoring script that collects buffer size and file count metrics for Prometheus Node Exporter. 4 | 5 | ## Features 6 | 7 | - Tracks disk usage of buffer files. 8 | - Reports buffer file count. 9 | - Generates Prometheus-compatible metrics. 10 | - Supports a configurable buffer path. 11 | 12 | ## Usage 13 | 14 | Set the required environment variable before running: 15 | 16 | ```sh 17 | export BUFFER_PATH=/path/to/buffers # Optional, default is /buffers 18 | ``` 19 | 20 | ### Prometheus Integration 21 | 22 | The script generates the following metrics for Prometheus Node Exporter: 23 | 24 | - `node_buffer_size_bytes`: Deprecated metric for buffer disk usage. 25 | - `logging_buffer_size_bytes`: New metric for buffer disk usage, including the host label. 26 | - `logging_buffer_files`: Number of buffer files. 27 | 28 | Metrics are stored in: 29 | 30 | ```sh 31 | /prometheus/node_exporter/textfile_collector/ 32 | ``` 33 | 34 | Ensure Node Exporter is configured to read from this directory. 35 | -------------------------------------------------------------------------------- /images/syslog-ng-reloader/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ghcr.io/kube-logging/custom-runner:v0.12.0 AS custom-runner 2 | 3 | FROM alpine:3.21.3@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c 4 | 5 | RUN apk add socat 6 | 7 | COPY --from=custom-runner /runner / 8 | 9 | WORKDIR / 10 | 11 | ENTRYPOINT ["/runner"] 12 | -------------------------------------------------------------------------------- /images/syslog-ng-reloader/README.md: -------------------------------------------------------------------------------- 1 | # SyslogNG reload image 2 | 3 | **SyslogNG reload** is a simple binary to trigger a reload when Kubernetes ConfigMaps or Secrets are updated. 4 | It watches mounted volume dirs and notifies the target process changed files on dirs. 5 | If changes exist - send webhook. 6 | 7 | It is available as a Docker image at `ghcr.io/kube-logging/logging-operator/syslog-ng-reloader` 8 | -------------------------------------------------------------------------------- /pkg/compression/compression.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package compression 16 | 17 | import ( 18 | "bytes" 19 | "compress/gzip" 20 | 21 | "github.com/go-logr/logr" 22 | ) 23 | 24 | func CompressString(str string, log logr.Logger) []byte { 25 | var b bytes.Buffer 26 | gz := gzip.NewWriter(&b) 27 | if _, err := gz.Write([]byte(str)); err != nil { 28 | log.Error(err, "Failed to compress string") 29 | } 30 | 31 | if err := gz.Close(); err != nil { 32 | log.Error(err, "Failed to close writer for compress string") 33 | } 34 | 35 | return b.Bytes() 36 | } 37 | -------------------------------------------------------------------------------- /pkg/resources/eventtailer/clusterrole.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package eventtailer 16 | 17 | import ( 18 | "github.com/cisco-open/operator-tools/pkg/reconciler" 19 | v1 "k8s.io/api/rbac/v1" 20 | "k8s.io/apimachinery/pkg/runtime" 21 | ) 22 | 23 | // ClusterRole resource for reconciler 24 | func (e *EventTailer) ClusterRole() (runtime.Object, reconciler.DesiredState, error) { 25 | clusterRole := v1.ClusterRole{ 26 | ObjectMeta: e.clusterObjectMeta(), 27 | Rules: []v1.PolicyRule{ 28 | { 29 | Verbs: []string{"get", "watch", "list"}, 30 | APIGroups: []string{"", "events.k8s.io"}, 31 | Resources: []string{"events"}, 32 | }, 33 | }, 34 | } 35 | return &clusterRole, reconciler.StatePresent, nil 36 | } 37 | -------------------------------------------------------------------------------- /pkg/resources/eventtailer/clusterrolebinding.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package eventtailer 16 | 17 | import ( 18 | "github.com/cisco-open/operator-tools/pkg/reconciler" 19 | rbacv1 "k8s.io/api/rbac/v1" 20 | "k8s.io/apimachinery/pkg/runtime" 21 | ) 22 | 23 | // ClusterRoleBinding resource for reconciler 24 | func (e *EventTailer) ClusterRoleBinding() (runtime.Object, reconciler.DesiredState, error) { 25 | clusterRoleBinding := rbacv1.ClusterRoleBinding{ 26 | ObjectMeta: e.clusterObjectMeta(), 27 | Subjects: []rbacv1.Subject{ 28 | { 29 | Kind: rbacv1.ServiceAccountKind, 30 | Name: e.Name(), 31 | Namespace: e.customResource.Spec.ControlNamespace, 32 | }, 33 | }, 34 | RoleRef: rbacv1.RoleRef{ 35 | APIGroup: rbacv1.GroupName, 36 | Kind: "ClusterRole", 37 | Name: e.Name(), 38 | }, 39 | } 40 | return &clusterRoleBinding, reconciler.StatePresent, nil 41 | } 42 | -------------------------------------------------------------------------------- /pkg/resources/eventtailer/serviceaccount.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package eventtailer 16 | 17 | import ( 18 | "github.com/cisco-open/operator-tools/pkg/reconciler" 19 | corev1 "k8s.io/api/core/v1" 20 | "k8s.io/apimachinery/pkg/runtime" 21 | ) 22 | 23 | // ServiceAccount resource for reconciler 24 | func (e *EventTailer) ServiceAccount() (runtime.Object, reconciler.DesiredState, error) { 25 | serviceAccount := corev1.ServiceAccount{ 26 | ObjectMeta: e.objectMeta(), 27 | } 28 | return &serviceAccount, reconciler.StatePresent, nil 29 | } 30 | -------------------------------------------------------------------------------- /pkg/resources/features.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2023 Kube logging authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package resources 16 | 17 | import ( 18 | "context" 19 | 20 | "github.com/spf13/cast" 21 | ) 22 | 23 | const ServiceMonitorKey = "ServiceMonitor" 24 | const PrometheusRuleKey = "PrometheusRule" 25 | 26 | func IsSupported(ctx context.Context, key string) bool { 27 | value := ctx.Value(key) 28 | return cast.ToBool(value) 29 | } 30 | -------------------------------------------------------------------------------- /pkg/resources/fluentbit/meta.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package fluentbit 16 | 17 | import ( 18 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 19 | ) 20 | 21 | // FluentbitObjectMeta creates an objectMeta for resource fluentbit 22 | func (r *Reconciler) FluentbitObjectMeta(name string) metav1.ObjectMeta { 23 | o := metav1.ObjectMeta{ 24 | Name: r.nameProvider.ComponentName(name), 25 | Namespace: r.Logging.Spec.ControlNamespace, 26 | Labels: r.getFluentBitLabels(), 27 | OwnerReferences: []metav1.OwnerReference{ 28 | r.nameProvider.OwnerRef(), 29 | }, 30 | } 31 | return *o.DeepCopy() 32 | } 33 | 34 | // FluentbitObjectMetaClusterScope creates an cluster scoped objectMeta for resource fluentbit 35 | func (r *Reconciler) FluentbitObjectMetaClusterScope(name string) metav1.ObjectMeta { 36 | o := metav1.ObjectMeta{ 37 | Name: r.nameProvider.ComponentName(name), 38 | Labels: r.getFluentBitLabels(), 39 | OwnerReferences: []metav1.OwnerReference{ 40 | r.nameProvider.OwnerRef(), 41 | }, 42 | } 43 | return o 44 | } 45 | -------------------------------------------------------------------------------- /pkg/resources/fluentd/component.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package fluentd 16 | 17 | const ( 18 | ComponentFluentd = "fluentd" 19 | ComponentConfigCheck = "fluentd-configcheck" 20 | ComponentDrainer = "fluentd-drainer" 21 | ComponentPlaceholder = "fluentd-placeholder" 22 | ) 23 | -------------------------------------------------------------------------------- /pkg/resources/loggingdataprovider/interface.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Cisco Systems, Inc. and/or its affiliates 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package loggingdataprovider 16 | 17 | import ( 18 | "context" 19 | ) 20 | 21 | type LoggingDataProvider interface { 22 | GetReplicaCount(ctx context.Context) (*int32, error) 23 | } 24 | -------------------------------------------------------------------------------- /pkg/resources/model/reconciler_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 Kube logging authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package model 16 | 17 | import "testing" 18 | 19 | func Test_hasIntersection(t *testing.T) { 20 | type args struct { 21 | a []string 22 | b []string 23 | } 24 | tests := []struct { 25 | name string 26 | args args 27 | want bool 28 | }{ 29 | { 30 | name: "no intersection empty", 31 | args: args{ 32 | a: []string{}, 33 | b: []string{}, 34 | }, 35 | want: false, 36 | }, 37 | { 38 | name: "no intersection nonempty", 39 | args: args{ 40 | a: []string{"a", "b", "c"}, 41 | b: []string{"d", "e"}, 42 | }, 43 | want: false, 44 | }, 45 | { 46 | name: "has intersection", 47 | args: args{ 48 | a: []string{"a", "b", "c"}, 49 | b: []string{"b"}, 50 | }, 51 | want: true, 52 | }, 53 | } 54 | for _, tt := range tests { 55 | t.Run(tt.name, func(t *testing.T) { 56 | if got := hasIntersection(tt.args.a, tt.args.b); got != tt.want { 57 | t.Errorf("hasIntersection() = %v, want %v", got, tt.want) 58 | } 59 | }) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /pkg/resources/prometheus-operator/helper.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2023 Kube logging authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package prometheus_operator 16 | 17 | import "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" 18 | 19 | func Duration(duration string) *v1.Duration { 20 | d := v1.Duration(duration) 21 | return &d 22 | } 23 | -------------------------------------------------------------------------------- /pkg/resources/reconciler.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package resources 16 | 17 | import ( 18 | "context" 19 | 20 | "github.com/cisco-open/operator-tools/pkg/reconciler" 21 | "github.com/go-logr/logr" 22 | "k8s.io/apimachinery/pkg/runtime" 23 | "sigs.k8s.io/controller-runtime/pkg/reconcile" 24 | ) 25 | 26 | // ComponentReconciler reconciler interface 27 | type ComponentReconciler func() (*reconcile.Result, error) 28 | 29 | type ContextAwareComponentReconciler func(context.Context) (*reconcile.Result, error) 30 | 31 | // Resource redeclaration of function with return type kubernetes Object 32 | type Resource func() (runtime.Object, reconciler.DesiredState, error) 33 | 34 | // ResourceWithLog redeclaration of function with logging parameter and return type kubernetes Object 35 | type ResourceWithLog func(log logr.Logger) runtime.Object 36 | -------------------------------------------------------------------------------- /pkg/resources/syslogng/component.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2022 Cisco Systems, Inc. and/or its affiliates 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package syslogng 16 | 17 | const ( 18 | ComponentSyslogNG = "syslog-ng" 19 | ComponentConfigCheck = "syslog-ng-configcheck" 20 | ComponentPlaceholder = "syslog-ng-placeholder" 21 | ) 22 | -------------------------------------------------------------------------------- /pkg/resources/syslogng/configsecret.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2022 Cisco Systems, Inc. and/or its affiliates 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package syslogng 16 | 17 | import ( 18 | "github.com/cisco-open/operator-tools/pkg/reconciler" 19 | "github.com/cisco-open/operator-tools/pkg/utils" 20 | corev1 "k8s.io/api/core/v1" 21 | "k8s.io/apimachinery/pkg/runtime" 22 | ) 23 | 24 | func (r *Reconciler) configSecret() (runtime.Object, reconciler.DesiredState, error) { 25 | secret := &corev1.Secret{ 26 | ObjectMeta: r.SyslogNGObjectMeta(configSecretName, ComponentSyslogNG), 27 | Data: map[string][]byte{ 28 | configKey: []byte(r.config), 29 | }, 30 | } 31 | secret.Labels = utils.MergeLabels( 32 | secret.Labels, 33 | map[string]string{"logging.banzaicloud.io/watch": "enabled"}, 34 | ) 35 | 36 | return secret, reconciler.StatePresent, nil 37 | } 38 | -------------------------------------------------------------------------------- /pkg/resources/templates/templates.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package templates 16 | 17 | import ( 18 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 19 | ) 20 | 21 | func Annotate(meta metav1.ObjectMeta, key, val string) metav1.ObjectMeta { 22 | if meta.Annotations == nil { 23 | meta.Annotations = make(map[string]string) 24 | } 25 | meta.Annotations[key] = val 26 | return meta 27 | } 28 | -------------------------------------------------------------------------------- /pkg/sdk/extensions/api/v1alpha1/groupversion_info.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package v1alpha1 contains API Schema definitions for the logging-extensions v1alpha1 API group 16 | // +kubebuilder:object:generate=true 17 | // +groupName=logging-extensions.banzaicloud.io 18 | package v1alpha1 19 | 20 | import ( 21 | "k8s.io/apimachinery/pkg/runtime/schema" 22 | "sigs.k8s.io/controller-runtime/pkg/scheme" 23 | ) 24 | 25 | var ( 26 | // GroupVersion is group version used to register these objects 27 | GroupVersion = schema.GroupVersion{Group: "logging-extensions.banzaicloud.io", Version: "v1alpha1"} 28 | 29 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 30 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 31 | 32 | // AddToScheme adds the types in this group-version to the given scheme. 33 | AddToScheme = SchemeBuilder.AddToScheme 34 | ) 35 | -------------------------------------------------------------------------------- /pkg/sdk/logging/api/v1alpha1/clusterflow_conversion.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package v1alpha1 16 | 17 | import ( 18 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/api/v1beta1" 19 | "sigs.k8s.io/controller-runtime/pkg/conversion" 20 | ) 21 | 22 | func (o *ClusterFlow) ConvertTo(dstRaw conversion.Hub) error { 23 | dst := dstRaw.(*v1beta1.ClusterFlow) 24 | 25 | Log.Info("ConvertTo", "source", o.TypeMeta, "destination", dst.TypeMeta) 26 | 27 | dst.ObjectMeta = o.ObjectMeta 28 | dst.Spec = o.Spec 29 | dst.Status = o.Status 30 | 31 | return nil 32 | } 33 | 34 | func (o *ClusterFlow) ConvertFrom(srcRaw conversion.Hub) error { 35 | src := srcRaw.(*v1beta1.ClusterFlow) 36 | 37 | Log.Info("ConvertFrom", "source", src.TypeMeta, "destination", o.TypeMeta) 38 | 39 | o.ObjectMeta = src.ObjectMeta 40 | o.Spec = src.Spec 41 | o.Status = src.Status 42 | 43 | return nil 44 | } 45 | -------------------------------------------------------------------------------- /pkg/sdk/logging/api/v1alpha1/conversion.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package v1alpha1 16 | 17 | import ( 18 | amruntime "k8s.io/apimachinery/pkg/runtime" 19 | ctrl "sigs.k8s.io/controller-runtime" 20 | ) 21 | 22 | var Log = ctrl.Log.WithName("conversion:v1alpha1") 23 | 24 | func APITypes() []amruntime.Object { 25 | return []amruntime.Object{&Logging{}, &Output{}, &ClusterOutput{}, &Flow{}, &ClusterFlow{}} 26 | } 27 | -------------------------------------------------------------------------------- /pkg/sdk/logging/api/v1alpha1/flow_conversion.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package v1alpha1 16 | 17 | import ( 18 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/api/v1beta1" 19 | "sigs.k8s.io/controller-runtime/pkg/conversion" 20 | ) 21 | 22 | func (o *Flow) ConvertTo(dstRaw conversion.Hub) error { 23 | dst := dstRaw.(*v1beta1.Flow) 24 | 25 | Log.Info("ConvertTo", "source", o.TypeMeta, "destination", dst.TypeMeta) 26 | 27 | dst.ObjectMeta = o.ObjectMeta 28 | dst.Spec = o.Spec 29 | dst.Status = o.Status 30 | 31 | return nil 32 | } 33 | 34 | func (o *Flow) ConvertFrom(srcRaw conversion.Hub) error { 35 | src := srcRaw.(*v1beta1.Flow) 36 | 37 | Log.Info("ConvertFrom", "source", src.TypeMeta, "destination", o.TypeMeta) 38 | 39 | o.ObjectMeta = src.ObjectMeta 40 | o.Spec = src.Spec 41 | o.Status = src.Status 42 | 43 | return nil 44 | } 45 | -------------------------------------------------------------------------------- /pkg/sdk/logging/api/v1alpha1/groupversion_info.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package v1alpha1 contains API Schema definitions for the logging v1alpha1 API group 16 | // +kubebuilder:object:generate=true 17 | // +groupName=logging.banzaicloud.io 18 | package v1alpha1 19 | 20 | import ( 21 | "k8s.io/apimachinery/pkg/runtime/schema" 22 | "sigs.k8s.io/controller-runtime/pkg/scheme" 23 | ) 24 | 25 | var ( 26 | // GroupVersion is group version used to register these objects 27 | GroupVersion = schema.GroupVersion{Group: "logging.banzaicloud.io", Version: "v1alpha1"} 28 | 29 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 30 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 31 | 32 | // AddToScheme adds the types in this group-version to the given scheme. 33 | AddToScheme = SchemeBuilder.AddToScheme 34 | ) 35 | -------------------------------------------------------------------------------- /pkg/sdk/logging/api/v1alpha1/logging_conversion.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package v1alpha1 16 | 17 | import ( 18 | "emperror.dev/errors" 19 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/api/v1beta1" 20 | "sigs.k8s.io/controller-runtime/pkg/conversion" 21 | ) 22 | 23 | func (o *Logging) ConvertTo(dstRaw conversion.Hub) error { 24 | dst := dstRaw.(*v1beta1.Logging) 25 | 26 | Log.Info("ConvertTo", "source", o.TypeMeta, "destination", dst.TypeMeta) 27 | 28 | Log.Error(errors.New("unsupported conversion"), "conversion is not supported, spec will be omitted") 29 | 30 | dst.ObjectMeta = o.ObjectMeta 31 | 32 | return nil 33 | } 34 | 35 | func (o *Logging) ConvertFrom(srcRaw conversion.Hub) error { 36 | src := srcRaw.(*v1beta1.Logging) 37 | 38 | Log.Info("ConvertFrom", "source", src.TypeMeta, "destination", o.TypeMeta) 39 | 40 | Log.Error(errors.New("unsupported conversion"), "conversion is not supported, spec will be omitted") 41 | 42 | o.ObjectMeta = src.ObjectMeta 43 | 44 | return nil 45 | } 46 | -------------------------------------------------------------------------------- /pkg/sdk/logging/api/v1alpha1/logging_types.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package v1alpha1 16 | 17 | import ( 18 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 19 | ) 20 | 21 | // +kubebuilder:object:root=true 22 | // +kubebuilder:subresource:status 23 | // +kubebuilder:resource:path=loggings,scope=Cluster,categories=logging-all 24 | 25 | // Logging is the Schema for the loggings API 26 | type Logging struct { 27 | metav1.TypeMeta `json:",inline"` 28 | metav1.ObjectMeta `json:"metadata,omitempty"` 29 | 30 | Spec LoggingSpec `json:"spec,omitempty"` 31 | Status LoggingStatus `json:"status,omitempty"` 32 | } 33 | 34 | type LoggingSpec struct{} 35 | type LoggingStatus struct{} 36 | 37 | // +kubebuilder:object:root=true 38 | 39 | // LoggingList contains a list of Logging 40 | type LoggingList struct { 41 | metav1.TypeMeta `json:",inline"` 42 | metav1.ListMeta `json:"metadata,omitempty"` 43 | Items []Logging `json:"items"` 44 | } 45 | 46 | func init() { 47 | SchemeBuilder.Register(&Logging{}, &LoggingList{}) 48 | } 49 | -------------------------------------------------------------------------------- /pkg/sdk/logging/api/v1beta1/groupversion_info.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package v1alpha2 contains API Schema definitions for the logging v1alpha2 API group 16 | // +kubebuilder:object:generate=true 17 | // +groupName=logging.banzaicloud.io 18 | package v1beta1 19 | 20 | import ( 21 | "k8s.io/apimachinery/pkg/runtime/schema" 22 | "sigs.k8s.io/controller-runtime/pkg/scheme" 23 | ) 24 | 25 | var ( 26 | // GroupVersion is group version used to register these objects 27 | GroupVersion = schema.GroupVersion{Group: "logging.banzaicloud.io", Version: "v1beta1"} 28 | 29 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 30 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 31 | 32 | // AddToScheme adds the types in this group-version to the given scheme. 33 | AddToScheme = SchemeBuilder.AddToScheme 34 | ) 35 | -------------------------------------------------------------------------------- /pkg/sdk/logging/maps/mapstrstr/helpers.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package mapstrstr 16 | 17 | // Keys returns the keys of a map[string]string 18 | func Keys(m map[string]string) []string { 19 | keys := make([]string, 0, len(m)) 20 | for k := range m { 21 | keys = append(keys, k) 22 | } 23 | return keys 24 | } 25 | 26 | func MergeInto(dst, src map[string]string) map[string]string { 27 | if len(src) > 0 { 28 | if dst == nil { 29 | dst = make(map[string]string) 30 | } 31 | for k, v := range src { 32 | dst[k] = v 33 | } 34 | } 35 | return dst 36 | } 37 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/filter/dedot_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package filter_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/filter" 21 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/render" 22 | "github.com/stretchr/testify/require" 23 | "sigs.k8s.io/yaml" 24 | ) 25 | 26 | func TestDedot(t *testing.T) { 27 | CONFIG := []byte(` 28 | de_dot_separator: "-" 29 | de_dot_nested: true 30 | 31 | `) 32 | expected := ` 33 | 34 | @type dedot 35 | @id test 36 | de_dot_nested true 37 | de_dot_separator - 38 | 39 | ` 40 | parser := &filter.DedotFilterConfig{} 41 | require.NoError(t, yaml.Unmarshal(CONFIG, parser)) 42 | test := render.NewOutputPluginTest(t, parser) 43 | test.DiffResult(expected) 44 | } 45 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/filter/detect_exceptions_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package filter_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/filter" 21 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/render" 22 | "github.com/stretchr/testify/require" 23 | "sigs.k8s.io/yaml" 24 | ) 25 | 26 | func TestDetectExceptions(t *testing.T) { 27 | CONFIG := []byte(` 28 | multiline_flush_interval: 0.1 29 | languages: 30 | - java 31 | - python 32 | `) 33 | expected := ` 34 | 35 | @type detect_exceptions 36 | @id test 37 | languages ["java","python"] 38 | multiline_flush_interval 0.1 39 | remove_tag_prefix kubernetes 40 | 41 | ` 42 | ed := &filter.DetectExceptions{} 43 | require.NoError(t, yaml.Unmarshal(CONFIG, ed)) 44 | test := render.NewOutputPluginTest(t, ed) 45 | test.DiffResult(expected) 46 | } 47 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/filter/elasticsearch_genid_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package filter_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/filter" 21 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/render" 22 | "github.com/stretchr/testify/require" 23 | "sigs.k8s.io/yaml" 24 | ) 25 | 26 | func TestElasticsearchGenId(t *testing.T) { 27 | CONFIG := []byte(` 28 | use_entire_record: true 29 | hash_type: sha1 30 | record_keys: key1,key2 31 | hash_id_key: gen_id 32 | separator: "|" 33 | `) 34 | expected := ` 35 | 36 | @type elasticsearch_genid 37 | @id test 38 | hash_id_key gen_id 39 | hash_type sha1 40 | record_keys key1,key2 41 | separator | 42 | use_entire_record true 43 | 44 | ` 45 | ed := &filter.ElasticsearchGenId{} 46 | require.NoError(t, yaml.Unmarshal(CONFIG, ed)) 47 | test := render.NewOutputPluginTest(t, ed) 48 | test.DiffResult(expected) 49 | } 50 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/filter/kube_events_timestamp_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package filter_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/filter" 21 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/render" 22 | "github.com/stretchr/testify/require" 23 | "sigs.k8s.io/yaml" 24 | ) 25 | 26 | func TestKubeEventsTimestamp(t *testing.T) { 27 | CONFIG := []byte(` 28 | timestamp_fields: 29 | - "event.eventTime" 30 | - "event.lastTimestamp" 31 | - "event.firstTimestamp" 32 | mapped_time_key: mytimefield 33 | 34 | `) 35 | expected := ` 36 | 37 | @type kube_events_timestamp 38 | @id test 39 | mapped_time_key mytimefield 40 | timestamp_fields ["event.eventTime","event.lastTimestamp","event.firstTimestamp"] 41 | 42 | ` 43 | parser := &filter.KubeEventsTimestampConfig{} 44 | require.NoError(t, yaml.Unmarshal(CONFIG, parser)) 45 | test := render.NewOutputPluginTest(t, parser) 46 | test.DiffResult(expected) 47 | } 48 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/filter/record_transformer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package filter_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/filter" 21 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/render" 22 | "github.com/stretchr/testify/require" 23 | "sigs.k8s.io/yaml" 24 | ) 25 | 26 | func TestRecordTransformer(t *testing.T) { 27 | CONFIG := []byte(` 28 | records: 29 | - foo: "bar" 30 | `) 31 | expected := ` 32 | 33 | @type record_transformer 34 | @id test 35 | 36 | foo bar 37 | 38 | 39 | ` 40 | parser := &filter.RecordTransformer{} 41 | require.NoError(t, yaml.Unmarshal(CONFIG, parser)) 42 | test := render.NewOutputPluginTest(t, parser) 43 | test.DiffResult(expected) 44 | } 45 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/filter/stdout_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package filter_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/filter" 21 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/render" 22 | "github.com/stretchr/testify/require" 23 | "sigs.k8s.io/yaml" 24 | ) 25 | 26 | func TestStdOut(t *testing.T) { 27 | CONFIG := []byte(` 28 | output_type: json 29 | `) 30 | expected := ` 31 | 32 | @type stdout 33 | @id test 34 | output_type json 35 | 36 | ` 37 | parser := &filter.StdOutFilterConfig{} 38 | require.NoError(t, yaml.Unmarshal(CONFIG, parser)) 39 | test := render.NewOutputPluginTest(t, parser) 40 | test.DiffResult(expected) 41 | } 42 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/filter/tagnormaliser_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package filter_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/filter" 21 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/render" 22 | "github.com/stretchr/testify/require" 23 | "sigs.k8s.io/yaml" 24 | ) 25 | 26 | func TestTagNormaliser(t *testing.T) { 27 | CONFIG := []byte(` 28 | format: cluster1.${namespace_name}.${pod_name}.${labels.app} 29 | `) 30 | expected := ` 31 | 32 | @type tag_normaliser 33 | @id test 34 | format cluster1.${namespace_name}.${pod_name}.${labels.app} 35 | 36 | ` 37 | parser := &filter.TagNormaliser{} 38 | require.NoError(t, yaml.Unmarshal(CONFIG, parser)) 39 | test := render.NewOutputPluginTest(t, parser) 40 | test.DiffResult(expected) 41 | } 42 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/filter/throttle_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package filter_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/filter" 21 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/render" 22 | "github.com/stretchr/testify/require" 23 | "sigs.k8s.io/yaml" 24 | ) 25 | 26 | func TestThrottle(t *testing.T) { 27 | CONFIG := []byte(` 28 | group_key: "kubernetes.container_name" 29 | group_bucket_period_s: 60 30 | group_bucket_limit: 6000 31 | group_reset_rate_s: 100 32 | `) 33 | expected := ` 34 | 35 | @type throttle 36 | @id test 37 | group_bucket_limit 6000 38 | group_bucket_period_s 60 39 | group_key kubernetes.container_name 40 | group_reset_rate_s 100 41 | 42 | ` 43 | parser := &filter.Throttle{} 44 | require.NoError(t, yaml.Unmarshal(CONFIG, parser)) 45 | test := render.NewOutputPluginTest(t, parser) 46 | test.DiffResult(expected) 47 | } 48 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/filter/useragent_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2023 Kube logging authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package filter_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/stretchr/testify/require" 21 | "sigs.k8s.io/yaml" 22 | 23 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/filter" 24 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/render" 25 | ) 26 | 27 | func TestUserAgent(t *testing.T) { 28 | CONFIG := []byte(` 29 | key_name: ua_string 30 | delete_key: true 31 | out_key: ua 32 | flatten: true 33 | `) 34 | expected := ` 35 | 36 | @type ua_parser 37 | @id test 38 | delete_key true 39 | flatten true 40 | key_name ua_string 41 | out_key ua 42 | 43 | ` 44 | parser := &filter.UserAgent{} 45 | require.NoError(t, yaml.Unmarshal(CONFIG, parser)) 46 | test := render.NewOutputPluginTest(t, parser) 47 | test.DiffResult(expected) 48 | } 49 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/input/tail.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package input 16 | 17 | import ( 18 | "github.com/cisco-open/operator-tools/pkg/secret" 19 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/types" 20 | ) 21 | 22 | // +kubebuilder:object:generate=true 23 | 24 | type TailInputConfig struct { 25 | Path string `json:"path"` 26 | } 27 | 28 | func NewTailInputConfig(path string) *TailInputConfig { 29 | return &TailInputConfig{Path: path} 30 | } 31 | 32 | func (c *TailInputConfig) ToDirective(secretLoader secret.SecretLoader, id string) (types.Directive, error) { 33 | const pluginType = "tail" 34 | return types.NewFlatDirective(types.PluginMeta{ 35 | Type: pluginType, 36 | Directive: "source", 37 | Id: id, 38 | }, c, secretLoader) 39 | } 40 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/output/gelf_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Cisco Systems, Inc. and/or its affiliates 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package output_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/output" 21 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/render" 22 | "github.com/stretchr/testify/require" 23 | "sigs.k8s.io/yaml" 24 | ) 25 | 26 | func TestGelfOutputConfig(t *testing.T) { 27 | CONFIG := []byte(` 28 | host: gelf-host 29 | port: 12201 30 | `) 31 | expected := ` 32 | 33 | @type gelf 34 | @id test 35 | host gelf-host 36 | port 12201 37 | 38 | @type file 39 | path /buffers/test.*.buffer 40 | retry_forever true 41 | timekey 10m 42 | timekey_wait 1m 43 | 44 | 45 | ` 46 | s := &output.GelfOutputConfig{} 47 | require.NoError(t, yaml.Unmarshal(CONFIG, s)) 48 | test := render.NewOutputPluginTest(t, s) 49 | test.DiffResult(expected) 50 | } 51 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/output/newrelic_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package output_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/output" 21 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/render" 22 | "github.com/stretchr/testify/require" 23 | "sigs.k8s.io/yaml" 24 | ) 25 | 26 | func TestNewRelic(t *testing.T) { 27 | CONFIG := []byte(` 28 | license_key: 29 | value: "000000000000000000000000" 30 | `) 31 | expected := ` 32 | 33 | @type newrelic 34 | @id test 35 | base_uri https://log-api.newrelic.com/log/v1 36 | license_key 000000000000000000000000 37 | 38 | @type file 39 | path /buffers/test.*.buffer 40 | retry_forever true 41 | timekey 10m 42 | timekey_wait 1m 43 | 44 | 45 | ` 46 | newrelic := &output.NewRelicOutputConfig{} 47 | require.NoError(t, yaml.Unmarshal(CONFIG, newrelic)) 48 | test := render.NewOutputPluginTest(t, newrelic) 49 | test.DiffResult(expected) 50 | } 51 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/output/null_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2024 Kube logging authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package output_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/stretchr/testify/require" 21 | "sigs.k8s.io/yaml" 22 | 23 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/output" 24 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/render" 25 | ) 26 | 27 | func TestNull(t *testing.T) { 28 | CONFIG := []byte(` 29 | never_flush: false 30 | `) 31 | 32 | expected := ` 33 | 34 | @type null 35 | @id test 36 | never_flush false 37 | 38 | ` 39 | 40 | null := &output.NullOutputConfig{} 41 | require.NoError(t, yaml.Unmarshal(CONFIG, null)) 42 | test := render.NewOutputPluginTest(t, null) 43 | test.DiffResult(expected) 44 | } 45 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/output/relabel_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package output_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/output" 21 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/render" 22 | "github.com/stretchr/testify/require" 23 | "sigs.k8s.io/yaml" 24 | ) 25 | 26 | func TestRelabel(t *testing.T) { 27 | CONFIG := []byte(` 28 | label: '@new-label' 29 | `) 30 | 31 | expected := ` 32 | 33 | @type relabel 34 | @id test 35 | @label @new-label 36 | 37 | ` 38 | 39 | relabel := &output.RelabelOutputConfig{} 40 | require.NoError(t, yaml.Unmarshal(CONFIG, relabel)) 41 | test := render.NewOutputPluginTest(t, relabel) 42 | test.DiffResult(expected) 43 | } 44 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/render/interface.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package render 16 | 17 | import ( 18 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/types" 19 | ) 20 | 21 | type Renderer interface { 22 | Render(config types.FluentConfig) error 23 | } 24 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/syslogng/config/channel.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package config 16 | 17 | import ( 18 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/syslogng/config/render" 19 | ) 20 | 21 | func channelDefStmt(source render.Renderer, transforms []render.Renderer) render.Renderer { 22 | return braceDefStmt("channel", "", render.AllOf( 23 | render.AllOf(source), 24 | render.AllOf(transforms...), 25 | )) 26 | } 27 | 28 | func channelRefStmt(name string) render.Renderer { 29 | return parenDefStmt("channel", render.Literal(name)) 30 | } 31 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/syslogng/config/destination.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package config 16 | 17 | import ( 18 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/syslogng/config/render" 19 | ) 20 | 21 | func destinationDefStmt(name string, body render.Renderer) render.Renderer { 22 | return braceDefStmt("destination", name, body) 23 | } 24 | 25 | func isActiveDestinationDriver(f Field) bool { 26 | return hasDestDriverTag(f) && isActiveField(f) 27 | } 28 | 29 | func hasDestDriverTag(f Field) bool { 30 | return structFieldSettings(f.Meta).Has("dest-drv") 31 | } 32 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/syslogng/config/render/render_test.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2020 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package render_test 16 | 17 | import ( 18 | "strings" 19 | "testing" 20 | 21 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/syslogng/config" 22 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/syslogng/config/render" 23 | "github.com/stretchr/testify/assert" 24 | ) 25 | 26 | func TestStringList(t *testing.T) { 27 | var expectedStringList string = `"field1", "field2", "field3"` 28 | var stringList = []string{"field1", "field2", "field3"} 29 | var renderer = render.StringList(stringList) 30 | 31 | options := config.OutputConfigCheckOptions{ 32 | IndentWith: " ", 33 | } 34 | actualStringList := &strings.Builder{} 35 | err := renderer(render.RenderContext{ 36 | Out: actualStringList, 37 | IndentWith: options.IndentWith, 38 | }) 39 | config.CheckError(t, options.ExpectedError, err) 40 | assert.Equal(t, expectedStringList, actualStringList.String()) 41 | 42 | } 43 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/syslogng/config/rewrite.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package config 16 | 17 | import ( 18 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/syslogng/config/render" 19 | ) 20 | 21 | func rewriteDefStmt(name string, body render.Renderer) render.Renderer { 22 | return braceDefStmt("rewrite", name, body) 23 | } 24 | 25 | func isActiveRewriteDriver(f Field) bool { 26 | return hasRewriteDriverTag(f) && isActiveField(f) 27 | } 28 | 29 | func hasRewriteDriverTag(f Field) bool { 30 | return structFieldSettings(f.Meta).Has("rewrite-drv") 31 | } 32 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/syslogng/config/source.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2019 Banzai Cloud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package config 16 | 17 | import ( 18 | "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/syslogng/config/render" 19 | ) 20 | 21 | type NetworkSourceDriver struct { 22 | __meta struct{} `syslog-ng:"name=network"` //lint:ignore U1000 field used for adding tag to the type 23 | Flags []string `syslog-ng:"name=flags,optional"` 24 | IP string `syslog-ng:"name=ip,optional"` 25 | Port uint16 `syslog-ng:"name=port,optional"` 26 | Transport string `syslog-ng:"name=transport,optional"` 27 | MaxConnections int `syslog-ng:"name=max-connections,optional"` 28 | LogIWSize int `syslog-ng:"name=log-iw-size,optional"` 29 | } 30 | 31 | func sourceDefStmt(name string, body render.Renderer) render.Renderer { 32 | return braceDefStmt("source", name, body) 33 | } 34 | -------------------------------------------------------------------------------- /pkg/sdk/logging/model/syslogng/config/syntax.go: -------------------------------------------------------------------------------- 1 | // Copyright © 2022 Cisco Systems, Inc. and/or its affiliates 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package config 16 | 17 | import "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/syslogng/config/render" 18 | 19 | func braceDefStmt(kind string, name string, body render.Renderer) render.Renderer { 20 | return render.AllOf( 21 | render.Line(render.SpaceSeparated(render.String(kind), render.If(name != "", render.Quoted(name)), render.String("{"))), 22 | render.Indented(body), 23 | render.Line(render.String("};")), 24 | ) 25 | } 26 | 27 | func parenDefStmt(kind string, args ...render.Renderer) render.Renderer { 28 | return render.Line(render.AllOf(optionExpr(kind, args...), render.String(";"))) 29 | } 30 | 31 | func optionExpr(key string, args ...render.Renderer) render.Renderer { 32 | return render.AllOf(render.String(key), render.String("("), render.SpaceSeparated(args...), render.String(")")) 33 | } 34 | -------------------------------------------------------------------------------- /scripts/check-header.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | read -r -d '' EXPECTED </dev/null; then 25 | # Replace the actual year with DATE so we can ignore the year when 26 | # checking for the license header. 27 | HEADER=$(head -n 13 $FILE | sed -E -e 's/Copyright © [0-9]+/Copyright © DATE/') 28 | if [ "$HEADER" != "$EXPECTED" ]; then 29 | echo "incorrect license header: $FILE" 30 | STATUS=1 31 | fi 32 | fi 33 | done 34 | 35 | exit $STATUS 36 | -------------------------------------------------------------------------------- /scripts/trigger-docs-update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euf 4 | 5 | OWNER='banzaicloud' 6 | REPO='logging-operator-docs' 7 | WORKFLOW='generate-docs.yml' 8 | RELEASE_TAG="$1" 9 | 10 | function main() 11 | { 12 | curl \ 13 | -X POST \ 14 | -H "Accept: application/vnd.github+json" \ 15 | -H "Authorization: token ${GITHUB_TOKEN}" \ 16 | "https://api.github.com/repos/${OWNER}/${REPO}/actions/workflows/${WORKFLOW}/dispatches" \ 17 | -d "{\"ref\":\"master\",\"inputs\":{\"release-tag\":\"${RELEASE_TAG}\"}}" 18 | } 19 | 20 | main "$@" 21 | --------------------------------------------------------------------------------