Log incoming traffic from specific clients
Match inbound traffic by SPIFFE ID so that only requests from a chosen namespace are logged.
Configuration
apiVersion: kuma.io/v1alpha1
kind: MeshAccessLog
metadata:
name: incoming-traffic-from-kong-mesh-demo
namespace: kong-mesh-demo
labels:
kuma.io/mesh: default
spec:
rules:
- matches:
- spiffeID:
type: Prefix
value: spiffe://default.zone-1.mesh.local/ns/kong-mesh-demo/sa
default:
backends:
- type: File
file:
path: "/dev/stdout"Copied!
type: MeshAccessLog
name: incoming-traffic-from-kong-mesh-demo
mesh: default
spec:
rules:
- matches:
- spiffeID:
type: Prefix
value: spiffe://default.zone-1.mesh.local/ns/kong-mesh-demo/sa
default:
backends:
- type: File
file:
path: "/dev/stdout"Copied!
Adjust konnect_mesh_control_plane.my_meshcontrolplane.id and konnect_mesh.my_mesh.name according to your current configuration.
resource "konnect_mesh_access_log" "incoming_traffic_from_kong_mesh_demo" {
provider = konnect-beta
type = "MeshAccessLog"
name = "incoming-traffic-from-kong-mesh-demo"
spec = {
rules = [
{
matches = [
{
spiffe_id = {
type = "Prefix"
value = "spiffe://default.zone-1.mesh.local/ns/kong-mesh-demo/sa"
}
}
]
default = {
backends = [
{
type = "File"
file = {
path = "/dev/stdout"
}
}
]
}
}
]
}
labels = {
"kuma.io/mesh" = konnect_mesh.my_mesh.name
}
cp_id = konnect_mesh_control_plane.my_meshcontrolplane.id
mesh = konnect_mesh.my_mesh.name
}
Copied!