From 93fc86f565cd7bc64415771dda7857dc9869df38 Mon Sep 17 00:00:00 2001 From: lm-aditya-kadam Date: Wed, 8 Apr 2026 10:56:22 +0530 Subject: [PATCH 1/3] feat(lm-logs): default cri container tail parser (#607) Use kubernetes.containerTailParserType (default cri) so kubernetes.conf emits a valid @type cri block for containerd/CRI-O logs. Keep multi_format + patterns as optional via Helm value. Bump chart to 1.1.0-rc02. --- charts/lm-logs/Chart.yaml | 4 ++-- charts/lm-logs/templates/configmap.yaml | 4 ++++ charts/lm-logs/values.schema.json | 6 ++++++ charts/lm-logs/values.yaml | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/charts/lm-logs/Chart.yaml b/charts/lm-logs/Chart.yaml index 6f3b68c..3f687fe 100644 --- a/charts/lm-logs/Chart.yaml +++ b/charts/lm-logs/Chart.yaml @@ -1,10 +1,10 @@ apiVersion: v2 description: A Helm chart for sending k8s logs to Logic Monitor name: lm-logs -version: 1.1.0 +version: 1.1.1 maintainers: - email: dev@logicmonitor.com name: LogicMonitor icon: https://logicmonitor.github.io/helm-charts/lm_logo.png appVersion: 1.4.0 -home: https://logicmonitor.github.io/helm-charts +home: https://logicmonitor.github.io/helm-charts \ No newline at end of file diff --git a/charts/lm-logs/templates/configmap.yaml b/charts/lm-logs/templates/configmap.yaml index c8c7daf..b171d31 100644 --- a/charts/lm-logs/templates/configmap.yaml +++ b/charts/lm-logs/templates/configmap.yaml @@ -93,6 +93,9 @@ data: tag "#{ENV['FLUENT_CONTAINER_TAIL_TAG'] || 'kubernetes.*'}" exclude_path "#{ENV['FLUENT_CONTAINER_TAIL_EXCLUDE_PATH'] || '/var/log/containers/{{ .Chart.Name }}*.log' }" + {{- if eq (.Values.kubernetes.containerTailParserType | default "cri") "cri" }} + @type cri + {{- else }} @type "#{ENV['FLUENT_CONTAINER_TAIL_PARSER_TYPE'] || 'multi_format'}" format json @@ -105,6 +108,7 @@ data: format none + {{- end }} diff --git a/charts/lm-logs/values.schema.json b/charts/lm-logs/values.schema.json index b3849df..e427634 100644 --- a/charts/lm-logs/values.schema.json +++ b/charts/lm-logs/values.schema.json @@ -387,6 +387,12 @@ "additionalProperties": false, "type": "object", "properties": { + "containerTailParserType": { + "type": "string", + "default": "cri", + "enum": ["cri", "multi_format"], + "description": "Fluentd tail parser type for container logs. Use 'cri' for containerd/CRI-O (recommended), 'multi_format' for legacy/mixed." + }, "multiline_start_regexp": { "type": "string" }, diff --git a/charts/lm-logs/values.yaml b/charts/lm-logs/values.yaml index ee2865e..ff5ebe1 100644 --- a/charts/lm-logs/values.yaml +++ b/charts/lm-logs/values.yaml @@ -100,6 +100,7 @@ securityContext: null priorityClassName: null kubernetes: + containerTailParserType: cri # "cri" (recommended for containerd/CRI-O) or "multi_format" multiline_start_regexp: /^\[(\d{4}-)?\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3}.*\]/ cluster_name: "" multiline_concat_key: log From 7a470b2a05cb26a923aa0ca8cd76c0f41ff094c1 Mon Sep 17 00:00:00 2001 From: lm-aditya-kadam Date: Wed, 6 May 2026 14:19:42 +0530 Subject: [PATCH 2/3] feat(lm-logs): add configurable monitor_agent (#627) * feat(lm-logs): add configurable monitor_agent for buffer metrics Add fluent.monitorAgent config block to expose Fluentd plugin/buffer metrics via HTTP when enabled. Conditionally inject into ConfigMap and expose containerPort on DaemonSet when enabled. Changes: - Add fluent.monitorAgent config (enabled, bind, port) in values.yaml - Conditionally include block in configmap.yaml template - Conditionally expose containerPort in deamonset.yaml template - Update values.schema.json with monitorAgent field definition - Bump chart version to 1.1.0-rc04 Feature disabled by default. Enable by setting: lm-logs: fluent: monitorAgent: enabled: true bind: 0.0.0.0 port: 24220 * feat(lm-logs): add configurable monitor_agent for buffer metrics Add fluent.monitorAgent config block to expose Fluentd plugin/buffer metrics via HTTP when enabled. Conditionally inject into ConfigMap and expose containerPort on DaemonSet when enabled. Changes: - Add fluent.monitorAgent config (enabled, bind, port) in values.yaml - Conditionally include block in configmap.yaml template - Conditionally expose containerPort in deamonset.yaml template - Update values.schema.json with monitorAgent field definition - Bump chart version to 1.1.1-rc01 --- charts/lm-logs/README.md | 55 +++++++++++++++++++++++++ charts/lm-logs/templates/configmap.yaml | 8 ++++ charts/lm-logs/templates/daemonset.yaml | 6 +++ charts/lm-logs/values.schema.json | 22 ++++++++++ charts/lm-logs/values.yaml | 12 ++++++ 5 files changed, 103 insertions(+) diff --git a/charts/lm-logs/README.md b/charts/lm-logs/README.md index 8dbcfea..a1dab83 100644 --- a/charts/lm-logs/README.md +++ b/charts/lm-logs/README.md @@ -74,8 +74,57 @@ The following tables lists the configurable parameters of the lm-logs chart and | `kubernetes.multiline_start_regexp` | Regexp to match beginning of multiline | `/^\[(\d{4}-)?\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3}.*\]/` | | `kubernetes.cluster_name` | (Required) Cluster name given while adding k8s cluster. Must be set for both standalone lm-logs and lm-container with lm-logs. | `""` | | `kubernetes.multiline_concat_key` | Key to look for fluentD to concatenate multiline logs | `"log"` | +| `fluent.monitorAgent.enabled` | Enable Fluentd monitor_agent to expose buffer metrics via HTTP | `false` | +| `fluent.monitorAgent.bind` | Bind address for monitor_agent HTTP server | `0.0.0.0` | +| `fluent.monitorAgent.port` | Listen port for monitor_agent HTTP server | `24220` | +| `fluent.extraFilters` | Extra Fluentd `` YAML injected after Kubernetes metadata (only `` blocks allowed) | `""` | +### Monitor Agent (Buffer Metrics) + +The `fluent.monitorAgent` feature exposes Fluentd plugin and buffer metrics via HTTP, allowing clients to monitor buffer usage and plugin status in real-time. + +#### Enable Monitor Agent + +To enable the monitor agent: + +```bash +helm install lm-logs logicmonitor/lm-logs -n \ + --set lm_company_name="" \ + --set lm_access_id="" \ + --set lm_access_key="" \ + --set kubernetes.cluster_name="" \ + --set fluent.monitorAgent.enabled=true +``` + +Or in your values file: + +```yaml +fluent: + monitorAgent: + enabled: true + bind: 0.0.0.0 + port: 24220 +``` + +#### Access Monitor Metrics + +After enabling, you can access the metrics endpoint: + +```bash +# Port forward to a pod +kubectl port-forward ds/lm-logs 24220:24220 -n + +# Query the metrics endpoint +curl http://127.0.0.1:24220/api/plugins.json +``` + +This provides insights into: +- Plugin status and configuration +- Buffer queue size and memory usage +- Retry counts and backoff state +- Flush metrics and performance data + #### Buffer configuration (Fluentd) The chart supports configuring all Fluentd buffer parameters. You can switch the buffer type between `memory` and `file`. @@ -115,6 +164,12 @@ buffer: All parameters are configurable, with the values above as defaults. +### Custom Fluentd filters + +Set `fluent.extraFilters` in your values file to inject additional Fluentd `` blocks after Kubernetes metadata enrichment. The chart only allows `` directives in this field; see `values.yaml` for commented examples. + +For more information about custom filters configurable via the lm-logs Helm chart, refer to: https://www.logicmonitor.com/support/custom-fluentd-filters-in-the-lm-logs-helm-chart + ### Available Environment variables For descriptions see: https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter diff --git a/charts/lm-logs/templates/configmap.yaml b/charts/lm-logs/templates/configmap.yaml index b171d31..e023237 100644 --- a/charts/lm-logs/templates/configmap.yaml +++ b/charts/lm-logs/templates/configmap.yaml @@ -22,6 +22,14 @@ data: log_level "#{ENV['FLUENT_LOG_LEVEL'] || 'warn'}" + {{- if .Values.fluent.monitorAgent.enabled }} + + @type monitor_agent + bind {{ .Values.fluent.monitorAgent.bind | default "0.0.0.0" }} + port {{ .Values.fluent.monitorAgent.port | default 24220 }} + + {{- end }} +