Skip to content

Commit

Permalink
Merge pull request #163 from appuio/fix/logforwarder-outputs
Browse files Browse the repository at this point in the history
Fix ClusterLogForwarder default pipelines
  • Loading branch information
DebakelOrakel authored Jan 15, 2025
2 parents 232a6a4 + 09cc187 commit fa2b4bd
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 55 deletions.
24 changes: 1 addition & 23 deletions component/log_forwarder.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,9 @@ local params = inv.parameters.openshift4_logging;
local lokiEnabled = params.components.lokistack.enabled;
local forwarderEnabled = lokiEnabled || std.length(params.clusterLogForwarder) > 0;

// Make sure the default output is added to the pipelines `outputRefs`,
// if the logging stack is not disabled.
local pipelineOutputRefs(pipeline) =
local default = if lokiEnabled then [ 'default' ] else [];
std.get(pipeline, 'forwarders', []) + default;

// clusterLogForwarderSpec:
// Consecutively apply patches to result of previous apply.
local clusterLogForwarderSpec = {
local appsPipeline = std.get(std.get(params.clusterLogForwarder, 'pipelines', {}), 'application-logs', {}),
local infraPipeline = std.get(std.get(params.clusterLogForwarder, 'pipelines', {}), 'infrastructure-logs', {}),
local auditPipeline = std.get(std.get(params.clusterLogForwarder, 'pipelines', {}), 'audit-logs', {}),

managementState: 'Managed',
collector: {
resources: {
Expand All @@ -39,19 +29,7 @@ local clusterLogForwarderSpec = {
filters: {},
inputs: {},
outputs: {},
pipelines: {
[if lokiEnabled || std.length(appsPipeline) > 0 then 'application-logs']: {
inputRefs: [ 'application' ],
outputRefs: pipelineOutputRefs(appsPipeline),
},
[if lokiEnabled || std.length(infraPipeline) > 0 then 'infrastructure-logs']: {
inputRefs: [ 'infrastructure' ],
outputRefs: pipelineOutputRefs(infraPipeline),
},
[if std.length(auditPipeline) > 0 then 'audit-logs']: {
inputRefs: [ 'audit' ],
},
},
pipelines: {},
} + com.makeMergeable(params.clusterLogForwarder);

// Unfold objects into array for ClusterLogForwarder resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,5 @@ spec:
- key: storagenode
operator: Exists
managementState: Managed
pipelines:
- inputRefs:
- application
name: application-logs
outputRefs:
- default
- inputRefs:
- infrastructure
name: infrastructure-logs
outputRefs:
- default
serviceAccount:
name: logcollector
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,12 @@ spec:
- name: custom-forwarder
type: syslog
pipelines:
- inputRefs:
- application
name: application-logs
- name: application-logs
outputRefs:
- default
- custom-forwarder
- inputRefs:
- audit
name: audit-logs
- name: audit-logs
outputRefs:
- custom-forwarder
- inputRefs:
- infrastructure
name: infrastructure-logs
outputRefs:
- default
- inputRefs:
- my-apps
name: my-apps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,7 @@ spec:
managementState: Managed
pipelines:
- detectMultilineErrors: true
inputRefs:
- application
name: application-logs
outputRefs:
- default
parse: json
- inputRefs:
- infrastructure
name: infrastructure-logs
outputRefs:
- default
serviceAccount:
name: logcollector

0 comments on commit fa2b4bd

Please sign in to comment.