diff --git a/charts/osm/README.md b/charts/osm/README.md index 07a0dba94a..fc5f72cb76 100644 --- a/charts/osm/README.md +++ b/charts/osm/README.md @@ -80,7 +80,6 @@ The following table lists the configurable parameters of the osm chart and their | OpenServiceMesh.fluentBit.enableProxySupport | bool | `false` | Enable proxy support toggle for Fluent Bit | | OpenServiceMesh.fluentBit.httpProxy | string | `""` | Optional HTTP proxy endpoint for Fluent Bit | | OpenServiceMesh.fluentBit.httpsProxy | string | `""` | Optional HTTPS proxy endpoint for Fluent Bit | -| OpenServiceMesh.fluentBit.logLevel | string | `"error"` | Log level for Fluent Bit | | OpenServiceMesh.fluentBit.name | string | `"fluentbit-logger"` | Fluent Bit sidecar container name | | OpenServiceMesh.fluentBit.outputPlugin | string | `"stdout"` | Fluent Bit output plugin | | OpenServiceMesh.fluentBit.primaryKey | string | `""` | Primary Key for Fluent Bit output plugin to Log Analytics | diff --git a/charts/osm/templates/fluentbit-configmap.yaml b/charts/osm/templates/fluentbit-configmap.yaml index b86a6e6d6c..4d852a7cd4 100644 --- a/charts/osm/templates/fluentbit-configmap.yaml +++ b/charts/osm/templates/fluentbit-configmap.yaml @@ -17,28 +17,10 @@ data: Path /var/log/containers/osm-controller-*_{{ include "osm.namespace" . }}_osm-controller-*.log Parser cri Read_from_Head on - # Helps grep filter identify logs of specified level generated by clusters running on cri-o + # Adds controller pod name value to help users query logs in output [FILTER] Name modify Match kube.* - Condition Key_value_matches message /"level":"{{ .Values.OpenServiceMesh.fluentBit.logLevel }}"/ - Set keep true - # Helps grep filter identify logs of specified level generated by clusters running on moby, containerd - [FILTER] - Name modify - Match kube.* - Condition Key_value_matches log \\"level\\":\\"{{ .Values.OpenServiceMesh.fluentBit.logLevel }}\\" - Set keep true - # Matches logs that have met conditions in any of the above filters - [FILTER] - Name grep - Match kube.* - Regex keep true - # Removes extra "keep: true" key/value pair once matching is complete; adds controller pod name value to help users query logs in output - [FILTER] - Name modify - Match kube.* - Remove keep Add controller_pod_name ${CONTROLLER_POD_NAME} [OUTPUT] Name {{ .Values.OpenServiceMesh.fluentBit.outputPlugin }} diff --git a/charts/osm/values.schema.json b/charts/osm/values.schema.json index 60dddde6dd..ac4ca0bddf 100644 --- a/charts/osm/values.schema.json +++ b/charts/osm/values.schema.json @@ -278,7 +278,6 @@ "registry": "fluent", "tag": "1.6.4", "pullPolicy": "IfNotPresent", - "logLevel": "error", "outputPlugin": "stdout", "enableProxySupport": "false", "httpProxy": "", @@ -290,7 +289,6 @@ "registry", "tag", "pullPolicy", - "logLevel", "outputPlugin", "enableProxySupport", "httpProxy", @@ -334,16 +332,6 @@ "IfNotPresent" ] }, - "logLevel": { - "$id": "#/properties/OpenServiceMesh/properties/fluentBit/properties/logLevel", - "type": "string", - "title": "The logLevel schema", - "description": "The Fluent Bit log level.", - "pattern": "^(debug|info|warn|error|fatal|panic|disabled|trace)$", - "examples": [ - "error" - ] - }, "outputPlugin": { "$id": "#/properties/OpenServiceMesh/properties/fluentBit/properties/outputPlugin", "type": "string", @@ -496,4 +484,4 @@ } }, "additionalProperties": true -} +} \ No newline at end of file diff --git a/charts/osm/values.yaml b/charts/osm/values.yaml index 0bfa9af4d0..6d456357c1 100644 --- a/charts/osm/values.yaml +++ b/charts/osm/values.yaml @@ -80,8 +80,6 @@ OpenServiceMesh: tag: 1.6.4 # -- PullPolicy for Fluent Bit sidecar container pullPolicy: IfNotPresent - # -- Log level for Fluent Bit - logLevel: error # -- Fluent Bit output plugin outputPlugin: stdout # -- WorkspaceId for Fluent Bit output plugin to Log Analytics diff --git a/docs/content/docs/tasks_usage/logs.md b/docs/content/docs/tasks_usage/logs.md index bf28d1b5fe..4f6faa1b8b 100644 --- a/docs/content/docs/tasks_usage/logs.md +++ b/docs/content/docs/tasks_usage/logs.md @@ -21,8 +21,9 @@ To quickly bring up Fluent Bit with default values, use: ```console osm install --enable-fluentbit ``` +By default, logs will be filtered to emit info level logs. You may change the log level to "debug", "warn", "fatal", "panic", "disabled" or "trace" during installation using `--set OpenServiceMesh.controllerLogLevel=` . To get _all_ logs, set the log level to trace. -However, once you have tried this out, we recommend configuring log forwarding to your preferred output for more informative results. +Once you have tried out this basic setup, we recommend configuring log forwarding to your preferred output for more informative results. To customize log forwarding to your output, follow these steps and then reinstall OSM with Fluent Bit enabled. @@ -30,11 +31,9 @@ To customize log forwarding to your output, follow these steps and then reinstal 1. The default configuration uses CRI log format parsing. If you are using a kubernetes distribution that causes your logs to be formatted differently, you may need to add a new parser to the `[PARSER]` section and change the `parser` name in the `[INPUT]` section to one of the parsers defined [here](https://github.com/fluent/fluent-bit/blob/master/conf/parsers.conf). -1. The logs are currently filtered to match "error" level logs and multiple filters have been used to cover differences in log formatting on various Kubernetes distros. - * To change the log level being filtered on, you can update the `logLevel` value in [`values.yaml`](https://github.com/openservicemesh/osm/blob/main/charts/osm/values.yaml) to "debug", "info", "warn", "fatal", "panic", "disabled" or "trace". - * To view all logs irrespective of log level, you may remove the `[FILTER]` sections. - * The modify filter has been used to add a `controller_pod_name` key/value pair to help you query logs in your output by refining results on pod name (see example usage below). - * If you wish to apply further filtering, explore [Fluent Bit filters](https://docs.fluentbit.io/manual/pipeline/filters). +1. Explore available [Fluent Bit Filters](https://docs.fluentbit.io/manual/pipeline/filters) and add as many `[FILTER]` sections as desired. + * The `[INPUT]` section tags ingested logs with `kube.*` so make sure to include `Match kube.*` key/value pair in each of your custom filters. + * The default configuration uses a modify filter to add a `controller_pod_name` key/value pair to help you query logs in your output by refining results on pod name (see example usage below). 1. For these changes to take effect, run: ```console @@ -43,7 +42,7 @@ To customize log forwarding to your output, follow these steps and then reinstal 1. Once you have updated the Fluent Bit ConfigMap template, you can deploy Fluent Bit during OSM installation using: ```console - osm install --enable-fluentbit + osm install --enable-fluentbit [--set OpenServiceMesh.controllerLogLevel=] ``` You should now be able to interact with error logs in the output of your choice as they get generated. diff --git a/tests/e2e/e2e_fluentbit_output_test.go b/tests/e2e/e2e_fluentbit_output_test.go index 2d138146e3..b980c74e10 100644 --- a/tests/e2e/e2e_fluentbit_output_test.go +++ b/tests/e2e/e2e_fluentbit_output_test.go @@ -27,7 +27,6 @@ var _ = OSMDescribe("Test deployment of Fluent Bit sidecar", // Install OSM with Fluentbit installOpts := Td.GetOSMInstallOpts() installOpts.DeployFluentbit = true - installOpts.SetOverrides = []string{"OpenServiceMesh.fluentBit.logLevel=info"} Expect(Td.InstallOSM(installOpts)).To(Succeed()) pods, err := Td.Client.CoreV1().Pods(Td.OsmNamespace).List(context.TODO(), metav1.ListOptions{ @@ -49,7 +48,6 @@ var _ = OSMDescribe("Test deployment of Fluent Bit sidecar", Expect(err).ToNot(HaveOccurred(), "Unable to get container logs") Expect(podLogs).To(ContainSubstring(logLevel)) Expect(podLogs).To(ContainSubstring("\"controller_pod_name\"=>\"osm-controller-")) - Expect(podLogs).NotTo(ContainSubstring("\"keep\"=>\"true\"")) } } }