Logging to multiple backends
This configuration logs to three backends: TCP, file and OpenTelemetry.
Configuration
apiVersion: kuma.io/v1alpha1
kind: MeshAccessLog
metadata:
name: multiple-backends
namespace: kuma-demo
labels:
kuma.io/mesh: default
spec:
rules:
- default:
backends:
- type: Tcp
tcp:
address: 127.0.0.1:5000
format:
type: Json
json:
- key: start_time
value: "%START_TIME%"
- type: File
file:
path: "/dev/stdout"
format:
type: Plain
plain: "[%START_TIME%]"
- type: OpenTelemetry
openTelemetry:
endpoint: otel-collector:4317
body:
kvlistValue:
values:
- key: mesh
value:
stringValue: "%KUMA_MESH%"
attributes:
- key: start_time
value: "%START_TIME%"
type: MeshAccessLog
name: multiple-backends
mesh: default
spec:
rules:
- default:
backends:
- type: Tcp
tcp:
address: 127.0.0.1:5000
format:
type: Json
json:
- key: start_time
value: "%START_TIME%"
- type: File
file:
path: "/dev/stdout"
format:
type: Plain
plain: "[%START_TIME%]"
- type: OpenTelemetry
openTelemetry:
endpoint: otel-collector:4317
body:
kvlistValue:
values:
- key: mesh
value:
stringValue: "%KUMA_MESH%"
attributes:
- key: start_time
value: "%START_TIME%"
Please adjust konnect_mesh_control_plane.my_meshcontrolplane.id and konnect_mesh.my_mesh.name according to your current configuration.
resource "konnect_mesh_access_log" "multiple_backends" {
provider = konnect-beta
type = "MeshAccessLog"
name = "multiple-backends"
spec = {
rules = [
{
default = {
backends = [
{
type = "Tcp"
tcp = {
address = "127.0.0.1:5000"
format = {
type = "Json"
json = [
{
key = "start_time"
value = "%START_TIME%"
}
]
}
}
},
{
type = "File"
file = {
path = "/dev/stdout"
format = {
type = "Plain"
plain = "[%START_TIME%]"
}
}
},
{
type = "OpenTelemetry"
open_telemetry = {
endpoint = "otel-collector:4317"
body = {
kvlist_value = ""
values = [
{
key = "mesh"
value = {
string_value = "%KUMA_MESH%"
}
}
]
}
attributes = [
{
key = "start_time"
value = "%START_TIME%"
}
]
}
}
]
}
}
]
}
labels = {
"kuma.io/mesh" = konnect_mesh.my_mesh.name
}
cp_id = konnect_mesh_control_plane.my_meshcontrolplane.id
mesh = konnect_mesh.my_mesh.name
}