Skip to content

Commit feedfa7

Browse files
committed
Add heurisitic debug message filtering
- This helps address forwarded message volume problems caused by UAA's verbose, on-by-default debug logs, while still allowing those logs to be left on the local disk so they will be available when needed for support purposes. - Integrators/mainifest maintainers have had to maintain this rule, making it available as a property simplifies their manifests. [Finishes #160691113]
1 parent 18ac6a0 commit feedfa7

File tree

5 files changed

+87
-6
lines changed

5 files changed

+87
-6
lines changed

jobs/syslog_forwarder/spec

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
name: syslog_forwarder
33

44
templates:
5+
blackbox_ctl.erb: bin/blackbox_ctl
6+
blackbox_config.yml.erb: config/blackbox_config.yml
7+
ca_cert.pem.erb: config/ca_cert.pem
8+
drain.erb: bin/drain
59
pre-start.erb: bin/pre-start
610
syslog-release.conf.erb: config/syslog-release.conf
7-
syslog-release-vcap-filter.conf.erb: config/syslog-release-vcap-filter.conf
811
syslog-release-custom-rules.conf.erb: config/syslog-release-custom-rules.conf
12+
syslog-release-debug-filter.conf.erb: config/syslog-release-debug-filter.conf
13+
syslog-release-file-exclusion.conf.erb: config/syslog-release-file-exclusion.conf
914
syslog-release-forwarding-rules.conf.erb: config/syslog-release-forwarding-rules.conf
1015
syslog-release-forwarding-setup.conf.erb: config/syslog-release-forwarding-setup.conf
11-
syslog-release-file-exclusion.conf.erb: config/syslog-release-file-exclusion.conf
12-
ca_cert.pem.erb: config/ca_cert.pem
13-
blackbox_ctl.erb: bin/blackbox_ctl
14-
blackbox_config.yml.erb: config/blackbox_config.yml
15-
drain.erb: bin/drain
16+
syslog-release-vcap-filter.conf.erb: config/syslog-release-vcap-filter.conf
1617

1718
packages:
1819
- blackbox
@@ -85,6 +86,21 @@ properties:
8586
This may be on by default in the future,
8687
though this would be a breaking/major version change.
8788
default: false
89+
syslog.heuristically_filter_debug_messages:
90+
description: >
91+
Drop messages with an msg that start with "DEBUG".
92+
This is intended to prevent high-volume,
93+
low-value debug logs from overwhelming syslog receivers,
94+
while still allowing the UAA job
95+
to log its debug messages to disk for support-enablement purposes.
96+
While this may impact other logs,
97+
most other jobs are not generally configured to emit debug logs,
98+
and anyone who wants to filter out UAA's debug volume
99+
likely doesn't mind losing the other debug volume, too.
100+
This filter is necessarily heuristic/string-based
101+
because syslog PRI information is not meaningful
102+
in logs produced by blackbox.
103+
default: false
88104

89105
syslog.tls_enabled:
90106
description: Set this to true to enable TLS.

jobs/syslog_forwarder/templates/pre-start.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ rsyslogd -N1 || (echo 'Custom rule configuration invalid' && rm /etc/rsyslog.d/3
3232
cp $(dirname $0)/../config/syslog-release-vcap-filter.conf /etc/rsyslog.d/32-syslog-release-vcap-filter.conf
3333
chmod 0644 /etc/rsyslog.d/32-syslog-release-vcap-filter.conf
3434

35+
36+
cp $(dirname $0)/../config/syslog-release-debug-filter.conf /etc/rsyslog.d/33-syslog-release-debug-filter.conf
37+
chmod 0644 /etc/rsyslog.d/33-syslog-release-debug-filter.conf
38+
3539
cp $(dirname $0)/../config/syslog-release-forwarding-rules.conf /etc/rsyslog.d/35-syslog-release-forwarding-rules.conf
3640
chmod 0644 /etc/rsyslog.d/35-syslog-release-forwarding-rules.conf
3741

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<% unless p('syslog.migration.disabled') || !p('syslog.heuristically_filter_debug_messages') %>
2+
if ($msg contains " DEBUG ") then stop
3+
<% end %>

tests/acceptance_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,24 @@ var _ = Describe("Optional features to reduce CF log volume", func() {
225225
}).ShouldNot(ContainSubstring(loggerMessage))
226226
})
227227
})
228+
Context("when DEBUG filtering is enabled to reduce volume", func() {
229+
BeforeEach(func() {
230+
Cleanup()
231+
Deploy("manifests/debug-filtering.yml")
232+
})
233+
It("filters logs that start with DEBUG while forwarding other logs", func() {
234+
By("continuing to forward logs from the filesystem")
235+
normalMessage := "INFO is not debug or DEBUG"
236+
Eventually(WriteToTestFile(normalMessage)).Should(gbytes.Say(normalMessage))
237+
238+
By("not forwarding logs that start with DEBUG")
239+
debugMessage := "DEBUG is debug, however"
240+
SendLogMessage(debugMessage)
241+
Consistently(func() string {
242+
return ForwardedLogs()
243+
}).ShouldNot(ContainSubstring(debugMessage))
244+
})
245+
})
228246
})
229247

230248
var _ = Describe("When syslog is configured to run in unprivileged mode", func() {

tests/manifests/debug-filtering.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: ((deployment))
3+
releases:
4+
- name: syslog
5+
version: latest
6+
stemcells:
7+
- alias: default
8+
os: ((stemcell-os))
9+
version: latest
10+
instance_groups:
11+
- name: forwarder
12+
instances: 1
13+
vm_type: default
14+
stemcell: default
15+
networks:
16+
- name: default
17+
azs:
18+
- z1
19+
jobs:
20+
- name: syslog_forwarder
21+
release: syslog
22+
properties:
23+
syslog:
24+
heuristically_filter_debug_messages: true
25+
- name: storer
26+
instances: 1
27+
vm_type: default
28+
stemcell: default
29+
networks:
30+
- name: default
31+
azs:
32+
- z1
33+
jobs:
34+
- name: syslog_storer
35+
release: syslog
36+
update:
37+
canaries: 1
38+
max_in_flight: 1
39+
canary_watch_time: 1000-60000
40+
update_watch_time: 1000-60000

0 commit comments

Comments
 (0)