Skip to content

Commit 0efdaf6

Browse files
santhoshkvudanaga-barripaliwalparitosh
authored
V3.0.2 (#46)
* Enable log collection for PersistentVolume and PersistentVolumeClaim * Multi process worker support - final set of changes * Updates to custom docker image instruction * V3.0.2 changelog, charts version changes * minor change for logs configmap template * add oci_images.tf; update dashboard import instructions * review comments, pull in change from PR#39 --------- Co-authored-by: Naga Raju Barri <naga.barri@oracle.com> Co-authored-by: paliwalparitosh <paritoshedx@gmail.com>
1 parent de39606 commit 0efdaf6

File tree

19 files changed

+810
-218
lines changed

19 files changed

+810
-218
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Change Log
22

3+
## 2023-07-24
4+
### Added
5+
- Support Fluentd's [Multi Process Workers](https://docs.fluentd.org/deployment/multi-process-workers).
6+
- Custom Container Image for Fluentd using OL8-Slim as base Image.
7+
- PV, PVC Objects Collection
8+
### Changed
9+
- Instructions and dependency versions updates to custom container image for Fluentd using OL8 as base image.
10+
- ClusterRole updates to add read permission for `storage.k8s.io` api group to support PV, PVC Objects collection.
11+
### Deprecating
12+
- Custom Container Image for Fluentd using Debian and OL8 as base Image.
13+
14+
## 2023-07-19
15+
### Added
16+
- Helm repo throguh Github pages.
17+
318
## 2023-06-14
419
### Added
520
- Kubernetes Metrics Collection to OCI Monitoring using OCI Management Agent.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Dashboards needs to be imported manually. Below is an example for importing Dash
138138
139139
1. Download and configure [OCI CLI](https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliinstall.htm) or open cloud-shell where OCI CLI is pre-installed. Alternative methods like REST API, SDK, Terraform etc can also be used.
140140
2. Find the **OCID** of the compartment, where the dashboards need to be imported.
141-
3. Download the dashboard JSONs from [here](logan/terraform/oke/modules/dashboards/dashboards_json/) (TBD).
141+
3. Download the dashboard JSONs from [here](terraform/modules/dashboards/dashboards_json/).
142142
4. **Replace** all the instances of the keyword - "`${compartment_ocid}`" in the JSONs with the **Compartment OCID** identified in previous step.
143143
* Following command is for quick reference that can be used in a linux/cloud-shell envirnment :
144144
@@ -153,6 +153,7 @@ Dashboards needs to be imported manually. Below is an example for importing Dash
153153
oci management-dashboard dashboard import --from-json file://node.json
154154
oci management-dashboard dashboard import --from-json file://workload.json
155155
oci management-dashboard dashboard import --from-json file://pod.json
156+
oci management-dashboard dashboard import --from-json file://service-type-lb.json
156157
```
157158
158159
##### 4 Uninstall

charts/common/templates/clusterrole.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ rules:
2323
- batch
2424
- discovery.k8s.io
2525
- metrics.k8s.io
26+
- storage.k8s.io
2627
resources:
2728
- '*'
2829
verbs:

charts/logan/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ apiVersion: v2
55
name: oci-onm-logan
66
description: Charts for sending Kubernetes platform logs, compute logs, and Kubernetes Objects information to OCI Logging Analytics.
77
type: application
8-
version: 3.0.1
8+
version: 3.0.2
99
appVersion: "3.0.0"
1010

1111
dependencies:
1212
- name: oci-onm-common
13-
version: "3.0.1"
13+
version: "3.0.2"
1414
repository: "file://../common"
1515
condition: oci-onm-common.enabled

charts/logan/templates/logs-configmap.yaml

Lines changed: 264 additions & 179 deletions
Large diffs are not rendered by default.

charts/logan/values.yaml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ fluentd:
151151
file: fluent.conf
152152
# -- Base directory on the node (with read write permission) for storing fluentd plugins related data.
153153
baseDir: /var/log
154+
# -- To enable MultiProcessWorkers, set this to (> 0) the number of required workers. Defaults to 0.
155+
# -- Set corresponding workerId using worker field against each source/log. When enabled MultiProcessWorkers, the default worker would be 0 until unless set for each source/log.
156+
multiProcessWorkers: 0
157+
154158
# Configuration for oci-logging-analytics fluentd output plugin
155159
ociLoggingAnalyticsOutputPlugin:
156160
# -- OCI API Key profile to use, if multiple profiles are found in the OCI API config file.
@@ -229,6 +233,9 @@ fluentd:
229233
#"Third Key": "Third Value"
230234
#ociLAEntityID:
231235
#encoding:
236+
# Worker number in case of multi process workers enabled. If not set when multi process workers enabled, then it defaults to 0.
237+
#worker:
238+
232239
logs:
233240
# -- Kube Proxy logs collection configuration
234241
kube-proxy:
@@ -245,6 +252,8 @@ fluentd:
245252
#ociLAEntityID:
246253
#ociLALogGroupID:
247254
#encoding:
255+
# Worker number in case of multi process workers enabled. If not set when multi process workers enabled, then it defaults to 0.
256+
#worker:
248257

249258
# -- Kube Flannel logs collection configuration
250259
kube-flannel:
@@ -296,6 +305,16 @@ fluentd:
296305
multilineStartRegExp: /^\S\d{2}\d{2}\s+[^\:]+:[^\:]+:[^\.]+\.\d{0,3}/
297306
# Configuration for Linux System specific logs like CronLogs and SecureLogs
298307
linuxSystem:
308+
# Setting the following properties will override the default/generic configuration and applies to all Kubernetes system logs
309+
#ociLALogGroupID:
310+
#metadata:
311+
#"Client Host Region": "America"
312+
#"Environment": "Production"
313+
#"Third Key": "Third Value"
314+
#ociLAEntityID:
315+
#encoding:
316+
# Worker number in case of multi process workers enabled. If not set when multi process workers enabled, then it defaults to 0.
317+
#worker:
299318
logs:
300319
# -- Linux CRON logs collection configuration
301320
cronlog:
@@ -375,19 +394,13 @@ fluentd:
375394
- '"/var/log/containers/csi-oci-node-*.log"'
376395
- '"/var/log/containers/proxymux-client-*.log"'
377396
- '"/var/log/containers/cluster-autoscaler-*.log"'
397+
# Worker number in case of multi process workers enabled. If not set when multi process workers enabled, then it defaults to 0.
398+
#worker: 1
378399

379400
# -- Configuration for any custom logs which are not part of the default configuration defined in this file.
380401
# All the pod/container logs will be collected as per "genericContainerLogs" section.
381402
# Use this section to create a custom configuration for any of the container logs.
382403
# Also, you can use this section to define configuration for any other log path existing on a Kubernetes worker node
383-
#custom-id1:
384-
#path: /var/log/containers/custom*.log
385-
# Logging Analytics log source to use for parsing and processing the logs:
386-
#ociLALogSourceName: "Custom1 Logs"
387-
# The regular expression pattern for the starting line in case of multi-line logs.
388-
#multilineStartRegExp:
389-
# Set isContainerLog to false if the log is not a container log (/var/log/containers/*.log). Default value is true.
390-
#isContainerLog: true
391404
customLogs:
392405
# A unique identifier to represent the configuration for a single log path
393406
#custom-id1:
@@ -398,6 +411,16 @@ fluentd:
398411
#multilineStartRegExp:
399412
# Set isContainerLog to false if the log is not a container log (/var/log/containers/*.log). Default value is true.
400413
#isContainerLog: true
414+
# Setting the following properties will override the default/generic configuration and applies to all Kubernetes system logs
415+
#ociLALogGroupID:
416+
#metadata:
417+
#"Client Host Region": "America"
418+
#"Environment": "Production"
419+
#"Third Key": "Third Value"
420+
#ociLAEntityID:
421+
#encoding:
422+
# Worker number in case of multi process workers enabled. If not set when multi process workers enabled, then it defaults to 0.
423+
#worker:
401424
#custom-id2:
402425
#path: /var/log/custom/*.log
403426
# Logging Analytics log source to use for parsing and processing the logs:
@@ -436,6 +459,10 @@ fluentd:
436459
api_endpoint: ""
437460
events:
438461
api_endpoint: ""
462+
persistent_volumes:
463+
api_endpoint: ""
464+
persistent_volume_claims:
465+
api_endpoint: ""
439466
daemon_sets:
440467
api_endpoint: apis/apps
441468
replica_sets:

charts/oci-onm/Chart.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type: application
1818
# This is the chart version. This version number should be incremented each time you make changes
1919
# to the chart and its templates, including the app version.
2020
# Versions are expected to follow Semantic Versioning (https://semver.org/)
21-
version: 3.0.1
21+
version: 3.0.2
2222

2323
# This is the version number of the application being deployed. This version number should be
2424
# incremented each time you make changes to the application. Versions are not expected to
@@ -28,11 +28,11 @@ appVersion: "3.0.0"
2828

2929
dependencies:
3030
- name: oci-onm-common
31-
version: "3.0.1"
31+
version: "3.0.2"
3232
repository: "file://../common"
3333
condition: oci-onm-common.enabled
3434
- name: oci-onm-logan
35-
version: "3.0.1"
35+
version: "3.0.2"
3636
repository: "file://../logan"
3737
condition: oci-onm-logan.enabled
3838
- name: oci-onm-mgmt-agent

docs/FAQ.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,83 @@ oci-onm-logan:
195195
# -----BEGIN RSA PRIVATE KEY-----
196196
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
197197
# -----END RSA PRIVATE KEY-----
198+
```
199+
200+
### Enable Multi Process Workers
201+
202+
**Note**: This feature will not work with custom fluentd configuration and if you set custom fluentd configuration, it would be placed under worker 0.
203+
204+
To enable multi-process workers feature of Fluentd, set value of `multiProcessWorkers` under oci-onm-logan to the desired number of workers. By default it is set 0, indicating that the feature is disabled. To assign different workers for different logs, you may set `worker` field to the desired worker id against each of the individual logs or group of logs as supported in the confguration. The default worker id is set to 0 for all the logs when enabling `multiProcessWorkers` feature. The following are few examples,
205+
206+
#### Example1
207+
208+
Enable multi-process worker feature with 2 workers and set the worker id 1 to all container logs (except custom logs) and keeping the default worker id (0) for the remaining all logs.
209+
198210
```
211+
..
212+
..
213+
oci-onm-logan:
214+
..
215+
..
216+
fluentd:
217+
...
218+
...
219+
multiProcessWorkers: 2
220+
...
221+
...
222+
genericContainerLogs:
223+
...
224+
...
225+
worker: 1
226+
```
227+
228+
#### Example2
229+
230+
Enable multi-process worker feature with 3 workers and set the worker id 1 to all container logs (except custom logs), worker id 2 to Kube Proxy, Linux Syslog and Kubelet logs, and keeping the default worker id (0) for the remaining all logs.
231+
232+
```
233+
..
234+
..
235+
oci-onm-logan:
236+
..
237+
..
238+
fluentd:
239+
...
240+
...
241+
multiProcessWorkers: 3
242+
...
243+
...
244+
kubernetesSystem:
245+
...
246+
...
247+
logs:
248+
...
249+
...
250+
kube-proxy:
251+
...
252+
...
253+
worker: 2
254+
...
255+
...
256+
...
257+
...
258+
linuxSystem:
259+
...
260+
...
261+
logs:
262+
...
263+
...
264+
syslog:
265+
...
266+
...
267+
worker: 2
268+
...
269+
...
270+
...
271+
...
272+
genericContainerLogs:
273+
...
274+
...
275+
worker: 1
276+
```
277+

docs/custom-images.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ By default, pre-built images by Oracle are used.
1212
##### Fluentd Container Image
1313

1414
- Download all the files from the below mentioned dir into a local machine having access to internet and docker installed.
15-
- [OL8](logan/docker-images/v1.0/oraclelinux/8/)
15+
- [OL8-Slim](logan/docker-images/v1.0/oraclelinux/8-slim/)
1616
- Run the following command to build the image.
1717
- `docker build -t oci-la-fluentd-collector-custom -f Dockerfile .`
1818
- The docker image built from the above step, can either be pushed to Docker Hub or OCI Container Registry (OCIR) or to a Local Docker Registry depending on the requirements.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Copyright (c) 2023, Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
### Build the docker image using multi-stage build
5+
6+
## To build/install all the dependencies
7+
8+
FROM container-registry.oracle.com/os/oraclelinux:8-slim AS builder
9+
10+
USER root
11+
WORKDIR /fluentd
12+
13+
# Environment variables
14+
ENV PATH /fluentd/vendor/bundle/ruby/2.7.0/bin:$PATH
15+
ENV GEM_PATH /fluentd/vendor/bundle/ruby/2.7.0:$GEM_PATH
16+
ENV GEM_HOME /fluentd/vendor/bundle/ruby/2.7.0
17+
# skip runtime bundler installation
18+
ENV FLUENTD_DISABLE_BUNDLER_INJECTION 1
19+
20+
COPY Gemfile* /fluentd/
21+
22+
# Install ruby, ruby-libs along with rubygems and bundler.
23+
RUN microdnf -y module enable ruby:2.7 \
24+
# Install ruby (it's dependencies gdbm-libs) and ruby-libs, disabling week dependencies
25+
&& microdnf -y install --setopt=install_weak_deps=0 --nodocs ruby-2.7.6 ruby-libs-2.7.6 gdbm-libs \
26+
# Install rubygems (it's dependencies rubygem-openssl rubygem-psych), disabling week dependencies
27+
&& microdnf -y install --setopt=install_weak_deps=0 --nodocs rubygems-3.1.6 \
28+
&& gem install bundler -v 2.3.25 \
29+
# Install development dependent packages for gems native installation
30+
&& microdnf -y install --nodocs gcc make redhat-rpm-config openssl ruby-devel gcc-c++ libtool libffi-devel bzip2 git \
31+
# Install Fluentd, it's dependencies along with other run time dependencies for OCI Logging Analytics Solution
32+
&& bundle config silence_root_warning true \
33+
&& bundle config --local path /fluentd/vendor/bundle \
34+
&& bundle config --global jobs 9 \
35+
&& bundle install --gemfile=/fluentd/Gemfile \
36+
# Install tini, init for containers (from EPEL repo)
37+
&& microdnf -y install oracle-epel-release-el8 \
38+
&& microdnf -y install tini-0.19.0 \
39+
# Install jemalloc (custom make with no docs)
40+
&& cd /tmp && ls /tmp \
41+
&& git clone -b 5.3.0 https://github.com/jemalloc/jemalloc.git && cd jemalloc/ \
42+
&& ./autogen.sh && make && make install_bin install_include install_lib \
43+
&& mv lib/libjemalloc.so.2 /usr/lib
44+
45+
## To build the final docker image
46+
47+
FROM container-registry.oracle.com/os/oraclelinux:8-slim
48+
49+
USER root
50+
WORKDIR /fluentd
51+
52+
# Environment variables
53+
ENV PATH /fluentd/vendor/bundle/ruby/2.7.0/bin:$PATH
54+
ENV GEM_PATH /fluentd/vendor/bundle/ruby/2.7.0:$GEM_PATH
55+
ENV GEM_HOME /fluentd/vendor/bundle/ruby/2.7.0
56+
# skip runtime bundler installation
57+
ENV FLUENTD_DISABLE_BUNDLER_INJECTION 1
58+
59+
# Install ruby, ruby-libs along with rubygems and bundler.
60+
RUN microdnf -y module enable ruby:2.7 \
61+
# Install ruby (it's dependencies gdbm-libs) and ruby-libs, disabling week dependencies
62+
&& microdnf -y install --setopt=install_weak_deps=0 --nodocs ruby-2.7.6 ruby-libs-2.7.6 gdbm-libs \
63+
# Install rubygems (it's dependencies rubygem-openssl rubygem-psych), disabling week dependencies
64+
&& microdnf -y install --setopt=install_weak_deps=0 --nodocs rubygems-3.1.6 \
65+
&& gem install bundler -v 2.3.25 \
66+
&& bundle config --local path /fluentd/vendor/bundle \
67+
# clear caches
68+
&& microdnf clean all \
69+
&& rm -rf /var/cache/dnf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem
70+
71+
# Copy binaries (tini & jemallco) and rubygems bundler environment from build stage
72+
COPY --from=builder /fluentd /fluentd
73+
COPY --from=builder /usr/bin/tini /usr/bin/tini
74+
COPY --from=builder /usr/lib/libjemalloc.so.2 /usr/lib/libjemalloc.so.2
75+
76+
RUN mkdir -p /fluentd/etc /fluentd/plugins \
77+
&& touch /fluentd/etc/disable.conf
78+
79+
# Environment variables
80+
ENV FLUENTD_CONF="/fluentd/etc/fluent.conf"
81+
ENV LD_PRELOAD="/usr/lib/libjemalloc.so.2"
82+
83+
COPY entrypoint.sh /fluentd/entrypoint.sh
84+
# Give execution permission to entrypoint.sh
85+
RUN ["chmod", "+x", "/fluentd/entrypoint.sh"]
86+
87+
# Overwrite ENTRYPOINT to run fluentd as root for /var/log / /var/lib
88+
ENTRYPOINT ["tini", "--", "/fluentd/entrypoint.sh"]

0 commit comments

Comments
 (0)