Skip to content

Commit

Permalink
Support creating LogFileMetricsExporter CR
Browse files Browse the repository at this point in the history
In logging version 5.8 and newer versions, the LogFileMetricExporter is no longer deployed with the collector by default.
You must manually create a LogFileMetricExporter custom resource (CR) to generate metrics from the logs produced by running containers.

If you do not create the LogFileMetricExporter CR, you may see a No datapoints found message in the OpenShift Container Platform web console dashboard for Produced Logs.
  • Loading branch information
DebakelOrakel committed Aug 7, 2024
1 parent 36503f7 commit 3be3b34
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 0 deletions.
12 changes: 12 additions & 0 deletions class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ parameters:
threshold: 85
for: 6h
severity: warning
logmetrics:
enabled: true
spec:
nodeSelector:
node-role.kubernetes.io/infra: ''
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 200m
memory: 128Mi

clusterLogging: {}

Expand Down
16 changes: 16 additions & 0 deletions component/logmetrics.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
local kap = import 'lib/kapitan.libjsonnet';
local kube = import 'lib/kube.libjsonnet';

local inv = kap.inventory();
local params = inv.parameters.openshift4_logging;

local logMetricExporter = kube._Object('logging.openshift.io/v1alpha1', 'LogFileMetricExporter', 'instance') {
metadata+: {
namespace: params.namespace,
},
spec: params.components.logmetrics.spec,
};

{
'70_logmetricsexporter': logMetricExporter,
}
1 change: 1 addition & 0 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ local subscriptions = std.filter(function(it) it != null, [
+ (import 'loki.libsonnet')
+ (import 'elasticsearch.libsonnet')
+ (import 'alertrules.libsonnet')
+ (import 'logmetrics.libsonnet')
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: logging.openshift.io/v1alpha1
kind: LogFileMetricExporter
metadata:
annotations: {}
labels:
name: instance
name: instance
namespace: openshift-logging
spec:
nodeSelector:
node-role.kubernetes.io/infra: ''
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 200m
memory: 128Mi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: logging.openshift.io/v1alpha1
kind: LogFileMetricExporter
metadata:
annotations: {}
labels:
name: instance
name: instance
namespace: openshift-logging
spec:
nodeSelector:
node-role.kubernetes.io/infra: ''
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 200m
memory: 128Mi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: logging.openshift.io/v1alpha1
kind: LogFileMetricExporter
metadata:
annotations: {}
labels:
name: instance
name: instance
namespace: openshift-logging
spec:
nodeSelector:
node-role.kubernetes.io/infra: ''
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 200m
memory: 128Mi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: logging.openshift.io/v1alpha1
kind: LogFileMetricExporter
metadata:
annotations: {}
labels:
name: instance
name: instance
namespace: openshift-logging
spec:
nodeSelector:
node-role.kubernetes.io/infra: ''
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 200m
memory: 128Mi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: logging.openshift.io/v1alpha1
kind: LogFileMetricExporter
metadata:
annotations: {}
labels:
name: instance
name: instance
namespace: openshift-logging
spec:
nodeSelector:
node-role.kubernetes.io/infra: ''
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 200m
memory: 128Mi

0 comments on commit 3be3b34

Please sign in to comment.