Closed mbrancato closed 1 month ago
Hi,
the extraArgs should work for each VM component. Can you see the -loggerJSONFields
flag in pod's cmd after adding it to values.yaml?
@Haleygo I'm referring to the actual operator binary. It seems to output in JSON, but it doesn't support remapping fields. It lists it in the help, but I don't see the code to implement it and it definitely doesn't seem to work.
In other words, this image: https://hub.docker.com/r/victoriametrics/operator or this release: https://github.com/VictoriaMetrics/operator/releases/tag/v0.44.0
I'm deploying with the helm chart and using extraArgs
to pass the loggerJSONFields
, resulting in a deployment with this:
template:
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/instance: victoria-metrics-operator
app.kubernetes.io/name: victoria-metrics-operator
spec:
containers:
- args:
- --zap-log-level=info
- --enable-leader-election
- --loggerFormat=json
- --loggerJSONFields=ts:timestamp,msg:message,level:severity
command:
- manager
env:
- name: WATCH_NAMESPACE
- name: POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: OPERATOR_NAME
value: victoria-metrics-operator
- name: VM_PSPAUTOCREATEENABLED
value: "false"
- name: VM_ENABLEDPROMETHEUSCONVERTEROWNERREFERENCES
value: "false"
image: victoriametrics/operator:v0.44.0
But the log fields are not remapped in the operator pod.
Okay, thanks for clarification.
Those flags are brought by github.com/VictoriaMetrics/VictoriaMetrics/lib/logger
which we don't use directly inside operator, but used by other package like github.com/VictoriaMetrics/VictoriaMetrics/lib/promrelabel
. Since we didn't Init the logger, those flags won't work.
And operator has it's own internal lib package github.com/VictoriaMetrics/operator/controllers/factory/logger
, we need to do some cleanup about the flags.
Is it possible for support for
loggerJSONFields
, as with other VM components, to be added to the operator? The operator seems to output in json by default, but the fields are not configurable from what I can tell.I added this to the values.yaml for the Helm chart with no success using 0.44.0: