Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 53990df

Browse files
authored
Merge pull request #288 from triggermesh/structured-logging
Log levels doc
2 parents bdb3c65 + a5d2681 commit 53990df

File tree

2 files changed

+84
-1
lines changed

2 files changed

+84
-1
lines changed

docs/guides/observability-logging.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
2+
# Structured Logging
3+
4+
TriggerMesh components communicate their internal events through a flexible logging system. Output format, structure,
5+
and granularity are adjustable through a configuration file. Information produced by the TriggerMesh logging system
6+
can be collected and stored by a centralized log management platform, such as the ELK stack or AWS CloudWatch, and used for further
7+
processing.
8+
9+
<!-- This guide describes available logging parameters and demonstrates possible configuration for centralized log
10+
management based on Fluent-bit and AWS CloudWatch Logs. -->
11+
12+
<!--
13+
## Centralized log management
14+
### Fluent-bit configuration
15+
### CloudWatch Logs
16+
-->
17+
18+
## Logging configuration
19+
20+
<!-- ### Zap core configuration -->
21+
22+
### Log levels
23+
24+
Log level configuration allows you to adjust the amount and detail of the logs produced by the TriggerMesh components.
25+
Logging configuration parameters are set through the configmap in the system namespace and applied on TriggerMesh
26+
components across all cluster namespaces.
27+
28+
Since TriggerMesh core components are heavily based on the Knative libraries, logging also complies with the upstream
29+
configuration approach described [here](https://knative.dev/docs/eventing/observability/logging/config-logging/).
30+
31+
### Level definitions
32+
33+
Log levels supported by TriggerMesh components are:
34+
35+
- `debug` - fine-grained debugging
36+
- `info` - normal logging
37+
- `warn` - unexpected but non-critical errors
38+
- `error` - critical errors; unexpected during normal operation
39+
- `dpanic` - in debug mode, trigger a panic (crash)
40+
- `panic` - trigger a panic (crash)
41+
- `fatal` - immediately exit with exit status 1 (failure)
42+
43+
Each logging level in this hierarchy includes all levels below, i.e. setting the `error` level will silence the output
44+
tagged as debug, info, and warn, but will keep error, panic, and fatal. Most information is produced at the `debug`
45+
level - it can come in handy during integration development and tests. In the `error` logging level nothing but errors
46+
that require the operator's attention is emitted. By default, all components are set to the `info` level that provides
47+
general initialization information and some additional outputs that may be useful for the operator.
48+
49+
### Configuring log levels
50+
51+
TriggerMesh components log levels are currently set from the `config-logging` configmap in `triggermesh` namespace. To
52+
update the component’s logging level, the configuration must be either edited in place by executing this command:
53+
54+
```console
55+
kubectl -n triggermesh edit configmap config-logging
56+
```
57+
58+
Or it can be changed in the project’s
59+
[source](https://github.com/triggermesh/triggermesh/blob/main/config/configmaps/config-logging.yaml) and applied with:
60+
61+
```console
62+
kubectl apply -f config-logging.yaml
63+
```
64+
65+
Components logging configuration is propagated through the containers environment and picked up at the initialization
66+
step, hence switching between levels may require resource re-creation.
67+
68+
The sample configuration fragment below sets the individual log levels for some of the TriggerMesh resources:
69+
70+
```yaml
71+
# Logging level overrides for the TriggerMesh control plane.
72+
loglevel.triggermesh-controller: error
73+
loglevel.triggermesh-webhook: error
74+
75+
# Logging level overrides for TriggerMesh components.
76+
# The name of the logger is the Kubernetes kind of the component.
77+
loglevel.awss3target: debug
78+
loglevel.ibmmqsource: debug
79+
loglevel.transformation: debug
80+
```
81+
82+
After we apply this configuration, TriggerMesh controller and webhook will switch to the `error` level, while all newly
83+
created AWS S3 targets, IBM MQ sources, and Transformations will have a `debug` logging level.

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ nav:
6767
- Tanzu Community Edition: guides/installation-tce.md
6868
- Observability:
6969
- '': guides/observability.md
70-
#- Structured logging: guides/observability-logging.md
70+
- Structured logging: guides/observability-logging.md
7171
- Telemetry metrics: guides/observability-metrics.md
7272
- Integration Language:
7373
- '': til/Introduction.md

0 commit comments

Comments
 (0)