From 8ea1fde7f8812ae249b4949800eb7e7bf285cc65 Mon Sep 17 00:00:00 2001 From: I504010 Date: Mon, 16 Dec 2024 15:28:25 +0100 Subject: [PATCH] [opentelemetry] test routing --- .../templates/logs-collector.yaml | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/system/opentelemetry/templates/logs-collector.yaml b/system/opentelemetry/templates/logs-collector.yaml index 3260802a9d..ee95dc176f 100644 --- a/system/opentelemetry/templates/logs-collector.yaml +++ b/system/opentelemetry/templates/logs-collector.yaml @@ -205,6 +205,17 @@ spec: - set(attributes["network.protocol.name"], ConvertCase(attributes["network.protocol.name"], "lower")) where attributes["network.protocol.name"] != nil - set(attributes["config.parsed"], "ingress-nginx") where attributes["client.address"] != nil + transform/ingress_test: + error_mode: ignore + log_statements: + - context: log + conditions: + - resource.attributes["app.label.name"] == "ingress-nginx" + statements: + - merge_maps(attributes, ExtractGrokPatterns(body, "%{IP:client.address} %{NOTSPACE:client.ident} %{NOTSPACE:client.auth} \\[%{HTTPDATE:timestamp}\\] \"%{WORD:request_method} %{NOTSPACE:request_path} %{WORD:network.protocol.name}/%{NOTSPACE:network.protocol.version}\" %{NUMBER:response} %{NUMBER:content_length:int} %{QUOTEDSTRING} \"%{GREEDYDATA:user_agent}\" %{NUMBER:request_length:int} %{BASE10NUM:request_time:float}( \\[%{NOTSPACE:service}\\])? ?(\\[\\])? %{IP:server.address}\\:%{NUMBER:server.port} %{NUMBER:upstream_response_length:int} %{BASE10NUM:upstream_response_time:float} %{NOTSPACE:upstream_status} %{NOTSPACE:request_id}", true),"upsert") + - set(attributes["network.protocol.name"], ConvertCase(attributes["network.protocol.name"], "lower")) where attributes["network.protocol.name"] != nil + - set(attributes["config.parsed_test"], "ingress-nginx_test") where attributes["client.address"] != nil + transform/ceph_rgw: error_mode: ignore log_statements: @@ -436,7 +447,12 @@ spec: description: all container log records. conditions: - IsMatch(attributes["log.type"], "containerd") - #routing: + routing: + default_pipelines: [logs/containerd] + error_mode: ignore + table: + - statement: route() where IsMatch(attributes["log.type"], "ingress.*") + pipelines: [logs/test] # default_pipelines: [logs/containerd] # error_mode: ignore # table: @@ -453,6 +469,10 @@ spec: level: detailed {{- end }} pipelines: + logs/test: + receivers: [filelog/containerd] + processors: [routing] + exporters: [opensearch/logs] logs/containerd: receivers: [filelog/containerd] processors: [k8sattributes,attributes/cluster,transform/ingress,transform/ceph_rgw,transform/ceph_osd,transform/kvm_openvswitch,transform/kvm_nova_agent]