Skip to content

Commit a98987c

Browse files
fix: logging (#1223)
* fix: disable mongo logs, fix traps logging * fix: run pre-commit, fix conflicts * fix: run pre-commit * fix: make mongo logging configurable * fix: make mongo logging configurable * fix: add docs * fix: fix traps helm template * fix: add CHANGELOG
1 parent 7b18a91 commit a98987c

File tree

40 files changed

+104
-9
lines changed

40 files changed

+104
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- update default microk8s to 1.33
88
- introduce `splunkMetricNameHyphenToUnderscore` parameter to make metric names follow Splunk schema
99
- change default walk to get only SNMPv2-MIB
10+
- add `disableMongoDebugLogging` parameter to disable extensive pymnogo logs while `logLevel` is set to `DEBUG`
1011

1112
### Fixed
1213
- fix text SNMP values with numbers and 'E' being interpreted as scientific notation

charts/splunk-connect-for-snmp/templates/traps/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ spec:
5959
value: "http://{{ printf "%s-%s" .Release.Name "mibserver" }}/standard.txt"
6060
- name: LOG_LEVEL
6161
value: {{ .Values.traps.logLevel | default "INFO" }}
62+
- name: DISABLE_MONGO_DEBUG_LOGGING
63+
value: {{ .Values.traps.disableMongoDebugLogging | quote }}
6264
- name: PYSNMP_DEBUG
6365
value: {{ .Values.pysnmpDebug | default "" | quote }}
6466
{{- if .Values.splunk.protocol }}

charts/splunk-connect-for-snmp/templates/worker/_helpers.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ Common labels
117117
{{- end}}
118118
- name: LOG_LEVEL
119119
value: {{ .Values.worker.logLevel | default "INFO" }}
120+
- name: DISABLE_MONGO_DEBUG_LOGGING
121+
value: {{ .Values.worker.disableMongoDebugLogging | quote }}
120122
- name: UDP_CONNECTION_TIMEOUT
121123
value: {{ .Values.worker.udpConnectionTimeout | default "3" | quote }}
122124
- name: MAX_OID_TO_PROCESS

charts/splunk-connect-for-snmp/values.schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,9 @@
651651
"logLevel": {
652652
"type": "string"
653653
},
654+
"disableMongoDebugLogging": {
655+
"type": ["string", "boolean"]
656+
},
654657
"podAntiAffinity": {
655658
"type": "string"
656659
},
@@ -833,6 +836,9 @@
833836
"logLevel": {
834837
"type": "string"
835838
},
839+
"disableMongoDebugLogging": {
840+
"type": ["string", "boolean"]
841+
},
836842
"nodeSelector": {
837843
"type": "object"
838844
},

charts/splunk-connect-for-snmp/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ worker:
389389
ignoreNotIncreasingOid: []
390390
# logging level, possible options: DEBUG, INFO, WARNING, ERROR, CRITICAL, or FATAL
391391
logLevel: "INFO"
392+
# disableMongoDebugLogging is used to disable extensive debug logging for MongoDB+pymongo while logLevel is set to DEBUG.
393+
disableMongoDebugLogging: true
392394
podAntiAffinity: soft
393395
# udpConnectionTimeout timeout in seconds for SNMP operations
394396
udpConnectionTimeout: 3
@@ -479,6 +481,8 @@ traps:
479481

480482
# logging level, possible options: DEBUG, INFO, WARNING, ERROR, CRITICAL, or FATAL
481483
logLevel: "INFO"
484+
# disableMongoDebugLogging is used to disable extensive debug logging for MongoDB+pymongo while logLevel is set to DEBUG.
485+
disableMongoDebugLogging: true
482486
nodeSelector: {}
483487
tolerations: []
484488
podAntiAffinity: soft

docker_compose/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ METRICS_INDEXING_ENABLED=false
5050
POLL_BASE_PROFILES=true
5151
IGNORE_NOT_INCREASING_OIDS=
5252
WORKER_LOG_LEVEL=INFO
53+
WORKER_DISABLE_MONGO_DEBUG_LOGGING=true
5354
UDP_CONNECTION_TIMEOUT=3
5455
MAX_OID_TO_PROCESS=70
5556

@@ -92,6 +93,7 @@ ENABLE_FULL_WALK=false
9293
SNMP_V3_SECURITY_ENGINE_ID=80003a8c04
9394
TRAPS_PORT=162
9495
TRAP_LOG_LEVEL=INFO
96+
TRAP_DISABLE_MONGO_DEBUG_LOGGING=true
9597

9698
# Scheduler configuration
9799
SCHEDULER_LOG_LEVEL=INFO

docker_compose/docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ x-workers_general_setup: &workers_general_setup
3333
POLL_BASE_PROFILES: ${POLL_BASE_PROFILES:-true}
3434
IGNORE_NOT_INCREASING_OIDS: ${IGNORE_NOT_INCREASING_OIDS:-}
3535
LOG_LEVEL: ${WORKER_LOG_LEVEL:-INFO}
36+
DISABLE_MONGO_DEBUG_LOGGING: ${WORKER_DISABLE_MONGO_DEBUG_LOGGING:-true}
3637
UDP_CONNECTION_TIMEOUT: ${UDP_CONNECTION_TIMEOUT:-3}
3738
MAX_OID_TO_PROCESS: ${MAX_OID_TO_PROCESS:-70}
3839
PROFILES_RELOAD_DELAY: ${PROFILES_RELOAD_DELAY:-60}
@@ -144,6 +145,7 @@ services:
144145
<<: [*general_sc4snmp_data, *splunk_general_setup, *pysnmp_debug, *ipv6]
145146
LOG_LEVEL: ${TRAP_LOG_LEVEL:-INFO}
146147
SNMP_V3_SECURITY_ENGINE_ID: ${SNMP_V3_SECURITY_ENGINE_ID:-80003a8c04}
148+
DISABLE_MONGO_DEBUG_LOGGING: ${TRAP_DISABLE_MONGO_DEBUG_LOGGING:-true}
147149
image: ${SC4SNMP_IMAGE}:${SC4SNMP_TAG:-latest}
148150
ports:
149151
- mode: host

docs/microk8s/configuration/trap-configuration.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ traps:
2222

2323
# Overrides the logLevel tag whose default is the chart
2424
logLevel: "WARN"
25+
# disableMongoDebugLogging is used to disable extensive debug logging for MongoDB+pymongo while logLevel is set to DEBUG.
26+
disableMongoDebugLogging: true
2527
# replicas: Number of replicas for trap container should be 2x number of nodes
2628
replicas: 2
2729
#loadBalancerIP: The IP address in the metallb pool

docs/microk8s/configuration/worker-configuration.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ worker:
149149
ignoreNotIncreasingOid: []
150150
# logging level, possible options: DEBUG, INFO, WARNING, ERROR, CRITICAL, or FATAL
151151
logLevel: "INFO"
152+
# disableMongoDebugLogging is used to disable extensive debug logging for MongoDB+pymongo while logLevel is set to DEBUG.
153+
disableMongoDebugLogging: true
152154
podAntiAffinity: soft
153155
# udpConnectionTimeout timeout in seconds for SNMP operations
154156
udpConnectionTimeout: 3
@@ -368,6 +370,7 @@ Trap worker uses in memory cache to store the results of the reverse dns lookup.
368370
| worker.walkMaxRetries | Maximum number of walk retries | 5 |
369371
| worker.ignoreNotIncreasingOid | Ignoring `occurred: OID not increasing` issues for hosts specified in the array | [] |
370372
| worker.logLevel | Logging level, possible options: DEBUG, INFO, WARNING, ERROR, CRITICAL, or FATAL | INFO |
373+
| worker.disableMongoDebugLogging | Disable extensive MongoDB and pymongo debug logging on SC4SNMP worker pods | true |
371374
| worker.podAntiAffinity | [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) | soft |
372375
| worker.udpConnectionTimeout | Timeout for SNMP operations in seconds | 3 |
373376
| worker.ignoreEmptyVarbinds | Ignores “Empty SNMP response message” in responses | false |

rendered/manifests/tests/splunk-connect-for-snmp/templates/traps/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ spec:
5656
value: "http://release-name-mibserver/standard.txt"
5757
- name: LOG_LEVEL
5858
value: INFO
59+
- name: DISABLE_MONGO_DEBUG_LOGGING
60+
value: "true"
5961
- name: PYSNMP_DEBUG
6062
value: ""
6163
- name: SPLUNK_HEC_SCHEME

0 commit comments

Comments
 (0)