Skip to content

Commit

Permalink
Merge pull request #113 from appuio/feat/support-multiline-detection
Browse files Browse the repository at this point in the history
Support detecting multiline errors
  • Loading branch information
DebakelOrakel authored Aug 14, 2023
2 parents b29ca18 + b276bda commit 9261627
Show file tree
Hide file tree
Showing 16 changed files with 482 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"template": "https://github.com/projectsyn/commodore-component-template.git",
"commit": "fc8ae18a6798d5b232442630883e5ec9b8636d09",
"commit": "3b16d0bdb15df8db3467d456afe2ab8a52dd096e",
"checkout": "main",
"context": {
"cookiecutter": {
"name": "OpenShift4 Logging",
"slug": "openshift4-logging",
"parameter_key": "openshift4_logging",
"test_cases": "defaults release-5.4 master lokistack",
"test_cases": "defaults release-5.4 master lokistack multilineerr",
"add_lib": "n",
"add_pp": "n",
"add_golden": "y",
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
- release-5.4
- master
- lokistack
- multilineerr
defaults:
run:
working-directory: ${{ env.COMPONENT_NAME }}
Expand All @@ -54,6 +55,7 @@ jobs:
- release-5.4
- master
- lokistack
- multilineerr
defaults:
run:
working-directory: ${{ env.COMPONENT_NAME }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile.vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ KUBENT_IMAGE ?= ghcr.io/doitintl/kube-no-trouble:latest
KUBENT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --entrypoint=/app/kubent $(KUBENT_IMAGE)

instance ?= defaults
test_instances = tests/defaults.yml tests/release-5.4.yml tests/master.yml tests/lokistack.yml
test_instances = tests/defaults.yml tests/release-5.4.yml tests/master.yml tests/lokistack.yml tests/multilineerr.yml
6 changes: 6 additions & 0 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -134,35 +134,41 @@ local namespace_groups = (
],
[if std.length(namespace_groups) > 0 then 'pipelines']: [
local enable_json = com.getValueOrDefault(namespace_groups[group], 'json', false);
local enable_multilineErrors = com.getValueOrDefault(namespace_groups[group], 'detectMultilineErrors', false);
local patch_json = { outputRefs: [ 'default' ], parse: 'json' };
{
name: group,
inputRefs: [ group ],
outputRefs: com.getValueOrDefault(namespace_groups[group], 'forwarders', []),
} + com.makeMergeable(if enable_json then patch_json else {})
+ com.makeMergeable(if enable_multilineErrors then { detectMultilineErrors: true } else {})
for group in std.objectFields(namespace_groups)
],
} + com.makeMergeable(
local enable_json = com.getValueOrDefault(params.clusterLogForwarding.application_logs, 'json', false);
local enable_multilineErrors = com.getValueOrDefault(params.clusterLogForwarding.application_logs, 'detectMultilineErrors', false);
{
pipelines: [
{
name: 'application-logs',
inputRefs: [ 'application' ],
outputRefs: com.getValueOrDefault(params.clusterLogForwarding.application_logs, 'forwarders', []) + [ 'default' ],
[if enable_json then 'parse']: 'json',
[if enable_multilineErrors then 'detectMultilineErrors']: true,
},
],
}
) + com.makeMergeable(
local enable_json = com.getValueOrDefault(params.clusterLogForwarding.infrastructure_logs, 'json', false);
local enable_multilineErrors = com.getValueOrDefault(params.clusterLogForwarding.infrastructure_logs, 'detectMultilineErrors', false);
{
[if params.clusterLogForwarding.infrastructure_logs.enabled then 'pipelines']: [
{
name: 'infrastructure-logs',
inputRefs: [ 'infrastructure' ],
outputRefs: com.getValueOrDefault(params.clusterLogForwarding.infrastructure_logs, 'forwarders', []) + [ 'default' ],
[if enable_json then 'parse']: 'json',
[if enable_multilineErrors then 'detectMultilineErrors']: true,
},
],
}
Expand Down
4 changes: 4 additions & 0 deletions docs/modules/ROOT/pages/references/parameters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,14 @@ clusterLogForwarding:
forwarders: <3>
- splunk-forwarder
json: true <4>
detectMultilineErrors: true <5>
----

<1> Namespace to configure.
<2> List of namespaces.
<3> List of forwarders (defined in `clusterLogForwarding.forwarders`).
<4> Enable json logging only for defined namespaces.
<5> Enable detecting multiline errors for defined namespaces.


=== `clusterLogForwarding.application_logs`
Expand All @@ -380,10 +382,12 @@ clusterLogForwarding:
forwarders: <1>
- splunk-forwarder
json: true <2>
detectMultilineErrors: true <3>
----

<1> List of forwarders (defined in `clusterLogForwarding.forwarders`).
<2> Enable json logging for all applications.
<3> Enable detecting multiline errors for all applications.


=== `clusterLogForwarding.infrastructure_logs`
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Namespace
metadata:
annotations:
openshift.io/node-selector: ''
labels:
name: openshift-logging
openshift.io/cluster-monitoring: 'true'
name: openshift-logging
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
annotations: {}
labels:
name: cluster-logging
name: cluster-logging
namespace: openshift-logging
spec:
targetNamespaces:
- openshift-logging
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
annotations: {}
labels:
name: cluster-logging
name: cluster-logging
namespace: openshift-logging
spec:
channel: stable-5.7
config:
resources:
limits:
memory: 256Mi
requests:
cpu: 10m
memory: 128Mi
installPlanApproval: Automatic
name: cluster-logging
source: redhat-operators
sourceNamespace: openshift-operators-redhat
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
annotations: {}
labels:
name: elasticsearch-operator
name: elasticsearch-operator
namespace: openshift-operators-redhat
spec:
channel: stable-5.7
config:
resources:
limits:
memory: 1.5Gi
requests:
cpu: 100m
memory: 1Gi
installPlanApproval: Automatic
name: elasticsearch-operator
source: openshift-operators-redhat
sourceNamespace: openshift-operators-redhat
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: logging.openshift.io/v1
kind: ClusterLogging
metadata:
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
labels:
name: instance
name: instance
namespace: openshift-logging
spec:
collection:
logs:
fluentd: {}
type: fluentd
logStore:
elasticsearch:
nodeCount: 3
nodeSelector:
node-role.kubernetes.io/infra: ''
redundancyPolicy: SingleRedundancy
storage:
size: 200Gi
retentionPolicy:
application:
maxAge: 7d
pruneNamespacesInterval: 15m
audit:
maxAge: 30d
pruneNamespacesInterval: 15m
infra:
maxAge: 30d
pruneNamespacesInterval: 15m
type: elasticsearch
managementState: Managed
visualization:
kibana:
nodeSelector:
node-role.kubernetes.io/infra: ''
replicas: 2
type: kibana
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: logging.openshift.io/v1
kind: ClusterLogForwarder
metadata:
annotations: {}
labels:
name: instance
name: instance
namespace: openshift-logging
spec:
pipelines:
- detectMultilineErrors: true
inputRefs:
- application
name: application-logs
outputRefs:
- default
parse: json
- inputRefs:
- infrastructure
name: infrastructure-logs
outputRefs:
- default
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
annotations: {}
labels:
machineconfiguration.openshift.io/role: master
name: 40-master-journald
name: 40-master-journald
spec:
config:
ignition:
version: 2.2.0
storage:
files:
- contents:
source: data:text/plain;charset=utf-8;base64,TWF4UmV0ZW50aW9uU2VjPTFtb250aApSYXRlTGltaXRCdXJzdD0xMDAwMApSYXRlTGltaXRJbnRlcnZhbD0xcwpTdG9yYWdlPXBlcnNpc3RlbnQKU3luY0ludGVydmFsU2VjPTFzCg==
filesystem: root
mode: 420
path: /etc/systemd/journald.conf
---
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
annotations: {}
labels:
machineconfiguration.openshift.io/role: worker
name: 40-worker-journald
name: 40-worker-journald
spec:
config:
ignition:
version: 2.2.0
storage:
files:
- contents:
source: data:text/plain;charset=utf-8;base64,TWF4UmV0ZW50aW9uU2VjPTFtb250aApSYXRlTGltaXRCdXJzdD0xMDAwMApSYXRlTGltaXRJbnRlcnZhbD0xcwpTdG9yYWdlPXBlcnNpc3RlbnQKU3luY0ludGVydmFsU2VjPTFzCg==
filesystem: root
mode: 420
path: /etc/systemd/journald.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
annotations: {}
labels:
name: allow-from-openshift-operators-redhat
name: allow-from-openshift-operators-redhat
spec:
ingress:
- from:
- namespaceSelector:
matchLabels:
name: openshift-operators-redhat
- podSelector:
matchLabels:
name: elasticsearch-operator
podSelector: {}
policyTypes:
- Ingress
Loading

0 comments on commit 9261627

Please sign in to comment.