etcd icon indicating copy to clipboard operation
etcd copied to clipboard

etcd log param to set error

Open songdechao opened this issue 3 years ago • 1 comments

What happened?

etcd --log-rotation-config-json={"maxsize": 100, "maxage": 7, "maxbackups": 7, "localtime": false, "compress": true} {"level":"info","ts":1659613158.4970117,"caller":"etcdmain/etcd.go:72","msg":"Running: ","args":["etcd","--log-rotation-config-json={maxsize:","100,","maxage:","7,","maxbackups:","7,","localtime:","false,","compress:","true}"]} {"level":"warn","ts":1659613158.4971104,"caller":"etcdmain/etcd.go:74","msg":"failed to verify flags","error":"'100,' is not a valid flag"}

What did you expect to happen?

success

How can we reproduce it (as minimally and precisely as possible)?

etcd --logger zap
--log-level info
--log-outputs /var/log/etcd/etcd.log
--enable-log-rotation true
--log-rotation-config-json {"maxsize": 100, "maxage": 7, "maxbackups": 7, "localtime": false, "compress": true}

Anything else we need to know?

No response

Etcd version (please run commands below)

exec etcd --name ${HOSTNAME}
--initial-advertise-peer-urls http://${HOSTNAME}.${SET_NAME}.${MY_NAMESPACE}.svc.cluster.local:2380
--listen-peer-urls http://${POD_IP}:2380
--listen-client-urls http://${POD_IP}:2379,http://127.0.0.1:2379
--advertise-client-urls http://${HOSTNAME}.${SET_NAME}.${MY_NAMESPACE}.svc.cluster.local:2379
--initial-cluster-token etcd-cluster-1
--data-dir /var/run/etcd/default.etcd
--initial-cluster $(initial_peers)
--initial-cluster-state new
--auto-compaction-retention 1
--max-request-bytes 10485760
--quota-backend-bytes 10737418240
--logger zap
--log-level info
--log-outputs /var/log/etcd/etcd.log
--enable-log-rotation true
--log-rotation-config-json {"maxsize": 100, "maxage": 7, "maxbackups": 7, "localtime": false, "compress": true}

Etcd configuration (command line flags or environment variables)

paste your configuration here

Etcd debug information (please run commands blow, feel free to obfuscate the IP address or FQDN in the output)

$ etcdctl member list -w table
# paste output here

$ etcdctl --endpoints=<member list> endpoint status -w table
# paste output here

Relevant log output

No response

songdechao avatar Aug 04 '22 11:08 songdechao

Hi @songdechao,

Can you try encapsulating your json-formatted log-rotation-config-json parameter, with single quotes ?

Without quotes:

~/projects/etcd$ etcd --log-rotation-config-json={"maxsize": 100, "maxage": 7, "maxbackups": 7, "localtime": false, "compress": true}
{"level":"info","ts":"2022-08-05T17:18:05.640+1000","caller":"etcdmain/etcd.go:73","msg":"Running: ","args":["etcd","--log-rotation-config-json={maxsize:","100,","maxage:","7,","maxbackups:","7,","localtime:","false,","compress:","true}"]}
{"level":"warn","ts":"2022-08-05T17:18:05.641+1000","caller":"etcdmain/etcd.go:75","msg":"failed to verify flags","error":"'100,' is not a valid flag"}

With quotes:

~/projects/etcd$ etcd --log-rotation-config-json='{"maxsize": 100, "maxage": 7, "maxbackups": 7, "localtime": false, "compress": true}'
{"level":"info","ts":"2022-08-05T17:18:45.089+1000","caller":"etcdmain/etcd.go:73","msg":"Running: ","args":["etcd","--log-rotation-config-json={\"maxsize\": 100, \"maxage\": 7, \"maxbackups\": 7, \"localtime\": false, \"compress\": true}"]}
{"level":"warn","ts":"2022-08-05T17:18:45.090+1000","caller":"etcdmain/etcd.go:105","msg":"'data-dir' was empty; using default","data-dir":"default.etcd"}
[...]
{"level":"info","ts":"2022-08-05T17:21:11.497+1000","caller":"embed/etcd.go:278","msg":"now serving peer/client/metrics","local-member-id":"8e9e05c52164694d","initial-advertise-peer-urls":["http://localhost:2380"],"listen-peer-urls":["http://localhost:2380"],"advertise-client-urls":["http://localhost:2379"],"listen-client-urls":["http://localhost:2379"],"listen-metrics-urls":[]}

jbml avatar Aug 05 '22 07:08 jbml

Thanks @jbml for the clarification.

ahrtr avatar Aug 22 '22 01:08 ahrtr