diff --git a/apis/fluentbit/v1alpha2/clusterinput_types.go b/apis/fluentbit/v1alpha2/clusterinput_types.go index 3de2180c6..d4be7ab27 100644 --- a/apis/fluentbit/v1alpha2/clusterinput_types.go +++ b/apis/fluentbit/v1alpha2/clusterinput_types.go @@ -78,6 +78,8 @@ type InputSpec struct { KubernetesEvents *input.KubernetesEvents `json:"kubernetesEvents,omitempty"` // ExecWasi defines the exec wasi input plugin configuration ExecWasi *input.ExecWasi `json:"execWasi,omitempty"` + // PrometheusRemoteWrite defines the Prometheus Remote Write input plugin configuration + PrometheusRemoteWrite *input.PrometheusRemoteWrite `json:"prometheusRemoteWrite,omitempty"` // Processors defines the processors configuration // +kubebuilder:pruning:PreserveUnknownFields Processors *plugins.Config `json:"processors,omitempty"` diff --git a/apis/fluentbit/v1alpha2/clusterinput_types_test.go b/apis/fluentbit/v1alpha2/clusterinput_types_test.go index 0a400302f..2a8a5647b 100644 --- a/apis/fluentbit/v1alpha2/clusterinput_types_test.go +++ b/apis/fluentbit/v1alpha2/clusterinput_types_test.go @@ -404,3 +404,48 @@ end`}, i++ } } + +func TestClusterInputList_Load_PrometheusRemoteWrite(t *testing.T) { + g := NewGomegaWithT(t) + + sl := plugins.NewSecretLoader(nil, "testnamespace") + + inputs := ClusterInputList{ + Items: []ClusterInput{ + { + TypeMeta: metav1.TypeMeta{ + APIVersion: "fluentbit.fluent.io/v1alpha2", + Kind: "ClusterInput", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "input-prometheus-remote-write", + }, + Spec: InputSpec{ + PrometheusRemoteWrite: &input.PrometheusRemoteWrite{ + Tag: "prom.rw", + Port: new(int32(8080)), + URI: "/api/prom/push", + }, + }, + }, + }, + } + + clusterInputs, err := inputs.Load(sl) + g.Expect(err).NotTo(HaveOccurred()) + g.Expect(clusterInputs).To(Equal(`[Input] + Name prometheus_remote_write + tag prom.rw + port 8080 + uri /api/prom/push +`)) + + clusterInputs, err = inputs.LoadAsYaml(sl, 0) + g.Expect(err).NotTo(HaveOccurred()) + g.Expect(clusterInputs).To(Equal(`inputs: + - name: prometheus_remote_write + tag: prom.rw + port: 8080 + uri: /api/prom/push +`)) +} diff --git a/apis/fluentbit/v1alpha2/plugins/input/prometheus_remote_write_types.go b/apis/fluentbit/v1alpha2/plugins/input/prometheus_remote_write_types.go new file mode 100644 index 000000000..48e57d269 --- /dev/null +++ b/apis/fluentbit/v1alpha2/plugins/input/prometheus_remote_write_types.go @@ -0,0 +1,68 @@ +package input + +import ( + "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" + "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" +) + +// +kubebuilder:object:generate:=true + +// The Prometheus Remote Write input plugin receives metrics sent with the Prometheus remote write protocol,
+// for example by Prometheus, Grafana Alloy or Fluent Bit's Prometheus Remote Write output.
+// **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/prometheus-remote-write** +type PrometheusRemoteWrite struct { + // Tag name associated to all metrics coming from this plugin. + Tag string `json:"tag,omitempty"` + // The address to listen on, defaults to 0.0.0.0. + Listen string `json:"listen,omitempty"` + // The port for Fluent Bit to listen on, defaults to 8080. + // Also add it to the ports of the FluentBit resource so that the Fluent Bit Service exposes it. + // +kubebuilder:validation:Minimum:=1 + // +kubebuilder:validation:Maximum:=65535 + Port *int32 `json:"port,omitempty"` + // The HTTP path that accepts remote write requests, e.g. /api/prom/push. + // If not set, requests are accepted on any path. + // +kubebuilder:validation:Pattern:="^/\\S*$" + URI string `json:"uri,omitempty"` + // Maximum size of a remote write request, defaults to 4M. + // +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$" + BufferMaxSize string `json:"bufferMaxSize,omitempty"` + // Size of the chunks allocated to read a request, up to bufferMaxSize, defaults to 512K. + // +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$" + BufferChunkSize string `json:"bufferChunkSize,omitempty"` + // HTTP status code returned for a successfully ingested request, defaults to 201. + // +kubebuilder:validation:Enum:=200;201;204 + SuccessfulResponseCode *int32 `json:"successfulResponseCode,omitempty"` + // Run the input in its own thread instead of the main event loop. + Threaded *bool `json:"threaded,omitempty"` + // TLS settings of the listener. Set crtFile and keyFile to accept remote write requests over HTTPS. + *plugins.TLS `json:"tls,omitempty"` +} + +func (*PrometheusRemoteWrite) Name() string { + return "prometheus_remote_write" +} + +// Params implement Section() method +func (p *PrometheusRemoteWrite) Params(sl plugins.SecretLoader) (*params.KVs, error) { + kvs := params.NewKVs() + + plugins.InsertKVString(kvs, "tag", p.Tag) + plugins.InsertKVString(kvs, "listen", p.Listen) + plugins.InsertKVField(kvs, "port", p.Port) + plugins.InsertKVString(kvs, "uri", p.URI) + plugins.InsertKVString(kvs, "buffer_max_size", p.BufferMaxSize) + plugins.InsertKVString(kvs, "buffer_chunk_size", p.BufferChunkSize) + plugins.InsertKVField(kvs, "successful_response_code", p.SuccessfulResponseCode) + plugins.InsertKVField(kvs, "threaded", p.Threaded) + + if p.TLS != nil { + tls, err := p.TLS.Params(sl) + if err != nil { + return nil, err + } + kvs.Merge(tls) + } + + return kvs, nil +} diff --git a/apis/fluentbit/v1alpha2/plugins/input/prometheus_remote_write_types_test.go b/apis/fluentbit/v1alpha2/plugins/input/prometheus_remote_write_types_test.go new file mode 100644 index 000000000..b1a296f3b --- /dev/null +++ b/apis/fluentbit/v1alpha2/plugins/input/prometheus_remote_write_types_test.go @@ -0,0 +1,106 @@ +package input + +import ( + "testing" + + "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins" + "github.com/fluent/fluent-operator/v3/apis/fluentbit/v1alpha2/plugins/params" + . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client/fake" +) + +func TestInput_PrometheusRemoteWrite_Params(t *testing.T) { + g := NewGomegaWithT(t) + + sl := plugins.NewSecretLoader(nil, "test namespace") + + prw := PrometheusRemoteWrite{ + Tag: "prom.rw", + Listen: "0.0.0.0", + Port: new(int32(9090)), + URI: "/api/prom/push", + BufferMaxSize: "8M", + BufferChunkSize: "1M", + SuccessfulResponseCode: new(int32(204)), + Threaded: new(true), + } + + expected := params.NewKVs() + expected.Insert("tag", "prom.rw") + expected.Insert("listen", "0.0.0.0") + expected.Insert("port", "9090") + expected.Insert("uri", "/api/prom/push") + expected.Insert("buffer_max_size", "8M") + expected.Insert("buffer_chunk_size", "1M") + expected.Insert("successful_response_code", "204") + expected.Insert("threaded", "true") + + kvs, err := prw.Params(sl) + g.Expect(err).NotTo(HaveOccurred()) + g.Expect(kvs).To(Equal(expected)) +} + +func TestInput_PrometheusRemoteWrite_ParamsOnlySetFields(t *testing.T) { + g := NewGomegaWithT(t) + + sl := plugins.NewSecretLoader(nil, "test namespace") + + kvs, err := (&PrometheusRemoteWrite{}).Params(sl) + g.Expect(err).NotTo(HaveOccurred()) + g.Expect(kvs).To(Equal(params.NewKVs())) + + kvs, err = (&PrometheusRemoteWrite{Port: new(int32(8080)), Threaded: new(false)}).Params(sl) + g.Expect(err).NotTo(HaveOccurred()) + expected := params.NewKVs() + expected.Insert("port", "8080") + expected.Insert("threaded", "false") + g.Expect(kvs).To(Equal(expected)) +} + +func TestInput_PrometheusRemoteWrite_ParamsTLS(t *testing.T) { + g := NewGomegaWithT(t) + + secret := &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{Name: "remote-write-tls", Namespace: "test namespace"}, + Data: map[string][]byte{ + "key-password": []byte("s3cr3t"), + }, + } + sl := plugins.NewSecretLoader(fake.NewClientBuilder().WithObjects(secret).Build(), "test namespace") + + keyPassword := func(key string) *plugins.Secret { + return &plugins.Secret{ValueFrom: plugins.ValueSource{ + SecretKeyRef: corev1.SecretKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{Name: "remote-write-tls"}, + Key: key, + }, + }} + } + + prw := PrometheusRemoteWrite{ + Port: new(int32(8443)), + TLS: &plugins.TLS{ + CRTFile: "/fluent-bit/tls/tls.crt", + KeyFile: "/fluent-bit/tls/tls.key", + KeyPassword: keyPassword("key-password"), + }, + } + + expected := params.NewKVs() + expected.Insert("port", "8443") + expected.Insert("tls", "On") + expected.Insert("tls.crt_file", "/fluent-bit/tls/tls.crt") + expected.Insert("tls.key_file", "/fluent-bit/tls/tls.key") + expected.Insert("tls.key_passwd", "s3cr3t") + + kvs, err := prw.Params(sl) + g.Expect(err).NotTo(HaveOccurred()) + g.Expect(kvs).To(Equal(expected)) + + prw.KeyPassword = keyPassword("missing") + kvs, err = prw.Params(sl) + g.Expect(err).To(HaveOccurred()) + g.Expect(kvs).To(BeNil()) +} diff --git a/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go b/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go index a48a662e2..69a948c6f 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go +++ b/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go @@ -329,6 +329,41 @@ func (in *Path) DeepCopy() *Path { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusRemoteWrite) DeepCopyInto(out *PrometheusRemoteWrite) { + *out = *in + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } + if in.SuccessfulResponseCode != nil { + in, out := &in.SuccessfulResponseCode, &out.SuccessfulResponseCode + *out = new(int32) + **out = **in + } + if in.Threaded != nil { + in, out := &in.Threaded, &out.Threaded + *out = new(bool) + **out = **in + } + if in.TLS != nil { + in, out := &in.TLS, &out.TLS + *out = new(plugins.TLS) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusRemoteWrite. +func (in *PrometheusRemoteWrite) DeepCopy() *PrometheusRemoteWrite { + if in == nil { + return nil + } + out := new(PrometheusRemoteWrite) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PrometheusScrapeMetrics) DeepCopyInto(out *PrometheusScrapeMetrics) { *out = *in diff --git a/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go b/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go index c6b5a86fa..86ae376d2 100644 --- a/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go +++ b/apis/fluentbit/v1alpha2/zz_generated.deepcopy.go @@ -1229,6 +1229,11 @@ func (in *InputSpec) DeepCopyInto(out *InputSpec) { *out = new(input.ExecWasi) (*in).DeepCopyInto(*out) } + if in.PrometheusRemoteWrite != nil { + in, out := &in.PrometheusRemoteWrite, &out.PrometheusRemoteWrite + *out = new(input.PrometheusRemoteWrite) + (*in).DeepCopyInto(*out) + } if in.Processors != nil { in, out := &in.Processors, &out.Processors *out = (*in).DeepCopy() diff --git a/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_clusterinputs.yaml b/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_clusterinputs.yaml index 57764f6e6..b91a4e150 100644 --- a/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_clusterinputs.yaml +++ b/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_clusterinputs.yaml @@ -500,6 +500,124 @@ spec: description: Processors defines the processors configuration type: object x-kubernetes-preserve-unknown-fields: true + prometheusRemoteWrite: + description: PrometheusRemoteWrite defines the Prometheus Remote Write + input plugin configuration + properties: + bufferChunkSize: + description: Size of the chunks allocated to read a request, up + to bufferMaxSize, defaults to 512K. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + bufferMaxSize: + description: Maximum size of a remote write request, defaults + to 4M. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + listen: + description: The address to listen on, defaults to 0.0.0.0. + type: string + port: + description: |- + The port for Fluent Bit to listen on, defaults to 8080. + Also add it to the ports of the FluentBit resource so that the Fluent Bit Service exposes it. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + successfulResponseCode: + description: HTTP status code returned for a successfully ingested + request, defaults to 201. + enum: + - 200 + - 201 + - 204 + format: int32 + type: integer + tag: + description: Tag name associated to all metrics coming from this + plugin. + type: string + threaded: + description: Run the input in its own thread instead of the main + event loop. + type: boolean + tls: + description: TLS settings of the listener. Set crtFile and keyFile + to accept remote write requests over HTTPS. + properties: + caFile: + description: Absolute path to CA certificate file + type: string + caPath: + description: Absolute path to scan for certificate files + type: string + crtFile: + description: Absolute path to Certificate file + type: string + debug: + description: |- + Set TLS debug verbosity level. + It accept the following values: 0 (No debug), 1 (Error), 2 (State change), 3 (Informational) and 4 Verbose + enum: + - 0 + - 1 + - 2 + - 3 + - 4 + format: int32 + type: integer + keyFile: + description: Absolute path to private Key file + type: string + keyPassword: + description: Optional password for tls.key_file file + properties: + valueFrom: + description: ValueSource defines how to find a value's + key. + properties: + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + type: object + verify: + description: Force certificate validation + type: boolean + vhost: + description: Hostname to be used for TLS SNI extension + type: string + type: object + uri: + description: |- + The HTTP path that accepts remote write requests, e.g. /api/prom/push. + If not set, requests are accepted on any path. + pattern: ^/\S*$ + type: string + type: object prometheusScrapeMetrics: description: PrometheusScrapeMetrics defines Prometheus Scrape Metrics Input configuration. diff --git a/charts/fluent-operator/crds/fluentbit.fluent.io_clusterinputs.yaml b/charts/fluent-operator/crds/fluentbit.fluent.io_clusterinputs.yaml index 36c2ff9d3..e99c1f075 100644 --- a/charts/fluent-operator/crds/fluentbit.fluent.io_clusterinputs.yaml +++ b/charts/fluent-operator/crds/fluentbit.fluent.io_clusterinputs.yaml @@ -498,6 +498,124 @@ spec: description: Processors defines the processors configuration type: object x-kubernetes-preserve-unknown-fields: true + prometheusRemoteWrite: + description: PrometheusRemoteWrite defines the Prometheus Remote Write + input plugin configuration + properties: + bufferChunkSize: + description: Size of the chunks allocated to read a request, up + to bufferMaxSize, defaults to 512K. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + bufferMaxSize: + description: Maximum size of a remote write request, defaults + to 4M. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + listen: + description: The address to listen on, defaults to 0.0.0.0. + type: string + port: + description: |- + The port for Fluent Bit to listen on, defaults to 8080. + Also add it to the ports of the FluentBit resource so that the Fluent Bit Service exposes it. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + successfulResponseCode: + description: HTTP status code returned for a successfully ingested + request, defaults to 201. + enum: + - 200 + - 201 + - 204 + format: int32 + type: integer + tag: + description: Tag name associated to all metrics coming from this + plugin. + type: string + threaded: + description: Run the input in its own thread instead of the main + event loop. + type: boolean + tls: + description: TLS settings of the listener. Set crtFile and keyFile + to accept remote write requests over HTTPS. + properties: + caFile: + description: Absolute path to CA certificate file + type: string + caPath: + description: Absolute path to scan for certificate files + type: string + crtFile: + description: Absolute path to Certificate file + type: string + debug: + description: |- + Set TLS debug verbosity level. + It accept the following values: 0 (No debug), 1 (Error), 2 (State change), 3 (Informational) and 4 Verbose + enum: + - 0 + - 1 + - 2 + - 3 + - 4 + format: int32 + type: integer + keyFile: + description: Absolute path to private Key file + type: string + keyPassword: + description: Optional password for tls.key_file file + properties: + valueFrom: + description: ValueSource defines how to find a value's + key. + properties: + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + type: object + verify: + description: Force certificate validation + type: boolean + vhost: + description: Hostname to be used for TLS SNI extension + type: string + type: object + uri: + description: |- + The HTTP path that accepts remote write requests, e.g. /api/prom/push. + If not set, requests are accepted on any path. + pattern: ^/\S*$ + type: string + type: object prometheusScrapeMetrics: description: PrometheusScrapeMetrics defines Prometheus Scrape Metrics Input configuration. diff --git a/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml b/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml index 93bd3272e..43ee35a47 100644 --- a/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml +++ b/config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml @@ -499,6 +499,124 @@ spec: description: Processors defines the processors configuration type: object x-kubernetes-preserve-unknown-fields: true + prometheusRemoteWrite: + description: PrometheusRemoteWrite defines the Prometheus Remote Write + input plugin configuration + properties: + bufferChunkSize: + description: Size of the chunks allocated to read a request, up + to bufferMaxSize, defaults to 512K. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + bufferMaxSize: + description: Maximum size of a remote write request, defaults + to 4M. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + listen: + description: The address to listen on, defaults to 0.0.0.0. + type: string + port: + description: |- + The port for Fluent Bit to listen on, defaults to 8080. + Also add it to the ports of the FluentBit resource so that the Fluent Bit Service exposes it. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + successfulResponseCode: + description: HTTP status code returned for a successfully ingested + request, defaults to 201. + enum: + - 200 + - 201 + - 204 + format: int32 + type: integer + tag: + description: Tag name associated to all metrics coming from this + plugin. + type: string + threaded: + description: Run the input in its own thread instead of the main + event loop. + type: boolean + tls: + description: TLS settings of the listener. Set crtFile and keyFile + to accept remote write requests over HTTPS. + properties: + caFile: + description: Absolute path to CA certificate file + type: string + caPath: + description: Absolute path to scan for certificate files + type: string + crtFile: + description: Absolute path to Certificate file + type: string + debug: + description: |- + Set TLS debug verbosity level. + It accept the following values: 0 (No debug), 1 (Error), 2 (State change), 3 (Informational) and 4 Verbose + enum: + - 0 + - 1 + - 2 + - 3 + - 4 + format: int32 + type: integer + keyFile: + description: Absolute path to private Key file + type: string + keyPassword: + description: Optional password for tls.key_file file + properties: + valueFrom: + description: ValueSource defines how to find a value's + key. + properties: + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + type: object + verify: + description: Force certificate validation + type: boolean + vhost: + description: Hostname to be used for TLS SNI extension + type: string + type: object + uri: + description: |- + The HTTP path that accepts remote write requests, e.g. /api/prom/push. + If not set, requests are accepted on any path. + pattern: ^/\S*$ + type: string + type: object prometheusScrapeMetrics: description: PrometheusScrapeMetrics defines Prometheus Scrape Metrics Input configuration. diff --git a/docs/fluentbit.md b/docs/fluentbit.md index d8f6a9b18..ad8545053 100644 --- a/docs/fluentbit.md +++ b/docs/fluentbit.md @@ -468,6 +468,7 @@ InputSpec defines the desired state of ClusterInput | udp | UDP defines the UDP input plugin configuration | *[input.UDP](plugins/fluentbit/input/udp.md) | | kubernetesEvents | KubernetesEvents defines the KubernetesEvents input plugin configuration | *[input.KubernetesEvents](plugins/fluentbit/input/kubernetes_events.md) | | execWasi | ExecWasi defines the exec wasi input plugin configuration | *[input.ExecWasi](plugins/fluentbit/input/exec_wasi.md) | +| prometheusRemoteWrite | PrometheusRemoteWrite defines the Prometheus Remote Write input plugin configuration | *[input.PrometheusRemoteWrite](plugins/fluentbit/input/prometheus_remote_write.md) | | processors | Processors defines the processors configuration | *plugins.Config | [Back to TOC](#table-of-contents) diff --git a/docs/plugins/fluentbit/index.md b/docs/plugins/fluentbit/index.md index b90fe4f6e..7824c3b80 100644 --- a/docs/plugins/fluentbit/index.md +++ b/docs/plugins/fluentbit/index.md @@ -2,6 +2,7 @@ - [dummy](input/dummy.md) - [fluentbit metrics](input/fluentbit_metrics.md) - [node exporter metrics](input/node_exporter_metrics.md) + - [prometheus remote write](input/prometheus_remote_write.md) - [prometheus scrape metrics](input/prometheus_scrape_metrics.md) - [systemd](input/systemd.md) - [tail](input/tail.md) diff --git a/docs/plugins/fluentbit/input/prometheus_remote_write.md b/docs/plugins/fluentbit/input/prometheus_remote_write.md new file mode 100644 index 000000000..814372f89 --- /dev/null +++ b/docs/plugins/fluentbit/input/prometheus_remote_write.md @@ -0,0 +1,16 @@ +# PrometheusRemoteWrite + +The Prometheus Remote Write input plugin receives metrics sent with the Prometheus remote write protocol,
for example by Prometheus, Grafana Alloy or Fluent Bit's Prometheus Remote Write output.
**For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/inputs/prometheus-remote-write** + + +| Field | Description | Scheme | +| ----- | ----------- | ------ | +| tag | Tag name associated to all metrics coming from this plugin. | string | +| listen | The address to listen on, defaults to 0.0.0.0. | string | +| port | The port for Fluent Bit to listen on, defaults to 8080. Also add it to the ports of the FluentBit resource so that the Fluent Bit Service exposes it. | *int32 | +| uri | The HTTP path that accepts remote write requests, e.g. /api/prom/push. If not set, requests are accepted on any path. | string | +| bufferMaxSize | Maximum size of a remote write request, defaults to 4M. | string | +| bufferChunkSize | Size of the chunks allocated to read a request, up to bufferMaxSize, defaults to 512K. | string | +| successfulResponseCode | HTTP status code returned for a successfully ingested request, defaults to 201. | *int32 | +| threaded | Run the input in its own thread instead of the main event loop. | *bool | +| tls | TLS settings of the listener. Set crtFile and keyFile to accept remote write requests over HTTPS. | *[plugins.TLS](../tls.md) | diff --git a/manifests/setup/setup.yaml b/manifests/setup/setup.yaml index 199b6dca7..3400d54c4 100644 --- a/manifests/setup/setup.yaml +++ b/manifests/setup/setup.yaml @@ -2752,6 +2752,124 @@ spec: description: Processors defines the processors configuration type: object x-kubernetes-preserve-unknown-fields: true + prometheusRemoteWrite: + description: PrometheusRemoteWrite defines the Prometheus Remote Write + input plugin configuration + properties: + bufferChunkSize: + description: Size of the chunks allocated to read a request, up + to bufferMaxSize, defaults to 512K. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + bufferMaxSize: + description: Maximum size of a remote write request, defaults + to 4M. + pattern: ^\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$ + type: string + listen: + description: The address to listen on, defaults to 0.0.0.0. + type: string + port: + description: |- + The port for Fluent Bit to listen on, defaults to 8080. + Also add it to the ports of the FluentBit resource so that the Fluent Bit Service exposes it. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + successfulResponseCode: + description: HTTP status code returned for a successfully ingested + request, defaults to 201. + enum: + - 200 + - 201 + - 204 + format: int32 + type: integer + tag: + description: Tag name associated to all metrics coming from this + plugin. + type: string + threaded: + description: Run the input in its own thread instead of the main + event loop. + type: boolean + tls: + description: TLS settings of the listener. Set crtFile and keyFile + to accept remote write requests over HTTPS. + properties: + caFile: + description: Absolute path to CA certificate file + type: string + caPath: + description: Absolute path to scan for certificate files + type: string + crtFile: + description: Absolute path to Certificate file + type: string + debug: + description: |- + Set TLS debug verbosity level. + It accept the following values: 0 (No debug), 1 (Error), 2 (State change), 3 (Informational) and 4 Verbose + enum: + - 0 + - 1 + - 2 + - 3 + - 4 + format: int32 + type: integer + keyFile: + description: Absolute path to private Key file + type: string + keyPassword: + description: Optional password for tls.key_file file + properties: + valueFrom: + description: ValueSource defines how to find a value's + key. + properties: + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + type: object + verify: + description: Force certificate validation + type: boolean + vhost: + description: Hostname to be used for TLS SNI extension + type: string + type: object + uri: + description: |- + The HTTP path that accepts remote write requests, e.g. /api/prom/push. + If not set, requests are accepted on any path. + pattern: ^/\S*$ + type: string + type: object prometheusScrapeMetrics: description: PrometheusScrapeMetrics defines Prometheus Scrape Metrics Input configuration.