You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,11 @@
1
1
# Change Log
2
2
3
+
## 2022-04-20
4
+
### Added
5
+
- Pod Annotations based customiation of configuration paremeters (oci_la_log_source_name, oci_la_log_group_id, oci_la_entity_id) for logs collected through "Kubernetes Container Generic Logs".
6
+
- README update for custom configuration documentation.
7
+
- Flush interval and timeout label configuration for Concat plugin section.
Copy file name to clipboardExpand all lines: README.md
+67-1Lines changed: 67 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,10 +125,11 @@ These yaml files needs to be applied using kubectl to create the necessary resou
125
125
- Use configmap-docker.yaml for Kubernetes clusters based off Docker runtime (e.g., OKE < 1.20) and configmap-cri.yaml for Kubernetes clusters based off CRI-O.
126
126
- Inline comments are available in the file for each of the source/filter/match blocks for easy reference for making any changes to the configuration.
127
127
- Refer [this](https://docs.oracle.com/en/learn/oci_logging_analytics_fluentd/) to learn about each of the Logging Analytics Fluentd Output plugin configuration parameters.
128
-
- *Note*: A generic source with time only parser is defined/configured for collecting all application pod logs from /var/log/containers/ out of the box.
128
+
- **Note**: A generic source with time only parser is defined/configured for collecting all application pod logs from /var/log/containers/ out of the box.
129
129
It is recommended to define and use a LogSource/LogParser at Logging Analytics for a given log type and then modify the configuration accordingly.
130
130
When adding a configuration (Source, Filter section) for any new container log, also exclude the log path from generic log collection,
131
131
by adding the log path to *exclude_path* field in *in_tail_containerlogs* source block. This is to avoid the duplicate collection of logs through generic log collection.
132
+
Refer [this](#custom-configuration) section for further details.
132
133
133
134
##### fluentd-daemonset.yaml
134
135
@@ -249,3 +250,68 @@ Use the following `helm uninstall` command to delete the chart. Provide the rele
249
250
helm uninstall <release-name>
250
251
```
251
252
253
+
## Custom Configuration
254
+
255
+
### How to use custom logSource (oci_la_log_source_name) and/or other custom configuration for Pod/Container Logs collected through "Kubernetes Container Generic Logs" logSource ?
256
+
257
+
A generic source with time only parser is defined/configured for collecting all application pod logs from /var/log/containers/ out of the box.
258
+
This is to ensure that all the logs generated by all pods are collected and pushed to Logging Analytics.
259
+
Often you may need to configure a custom logSource for a particular pod log, either by using one of the existing OOB logSources at Logging Analytics or by defining one custom logSource matching to the requirements.
260
+
Once you have defined/identified a logSource for a particular pod log, the following are couple of ways to get those pod logs associated to the logSource.
261
+
262
+
#### Through Pod Annotations
263
+
264
+
In this approach, all that you need to do is add the following annotation, "oracle.com/oci_la_log_source_name" (with logSourceName as value) to all the pods of choice.
265
+
This approach works for all the use-cases, except for multi-line plain text formatted logs.
266
+
267
+
- Refer [this doc](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) to find how to add the annotation through Pod's metadata section. This is the recommended approach as it provides the persistent behavior.
268
+
- Refer [this doc](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#annotate) to find how to add annotation through 'kubectl annotate' command. You may use this approach for quick testing.
269
+
270
+
**Note** The following configuration parameters are supported for customisation through Pod Annotations in addition to logSource,
271
+
- oracle.com/oci_la_log_group_id => to use custom logGroupId (oci_la_log_group_id)
272
+
- oracle.com/oci_la_entity_id => to use custom entityId (oci_la_entity_id)
273
+
274
+
#### Through Custom Fluentd conf
275
+
276
+
In this approach, a new set of Source, Filter sections have to be created in the fluentd config.
277
+
The following example demonstrates a custom fluentd config to tag /var/log/containers/frontend*.log with logSource "Guestbook Frontend Logs"
278
+
(*to be added to helm-chart values.yaml, under fluentd:configMapLogsFiles:kubernetes.conf value if using helm chart OR to either of configmap-cri.yaml / configmap-docker.yaml if using kubectl approach).
**Note**: The log path */var/log/containers/frontend-*.log* has to be excluded from the generic container logs to avoid duplicate log collection. Add the log path to *exclude_path* value under *in_tail_containerlogs* source section.
315
+
316
+
In addition to the above, you may need to modify the source section to add *multiline* parser, if the logs are of plain text multi-line format (OR) add a concat plugin filter if the logs are of say multi-line but wrapped in json.
317
+
Refer OOB fluentd config in the helm-cahrt values.yaml for examples.
0 commit comments