Caddy Log time is not CentOS7 time,Time synchronization And read-only file system

1. Output of caddy version:

v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=

2. How I run Caddy:

systemctl start caddy

a. System environment:


b. Command:

systemctl  restart caddy

c. Service/unit/compose file:

# caddy.service
# For using Caddy with a config file.
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
# See for instructions.
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.


ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --force


d. My complete Caddy config:

(handle_log) {
	log {
		output file /etc/caddy/logs/caddy2.log
		level INFO

(handle_errors) {
    handle_errors {
        respond "{http.error.status_code} {http.error.status_text}"
} {

	encode gzip

        import handle_errors

        import handle_log

	route /merchant/* {
		uri strip_prefix /merchant

		file_server {
			root /opt/twomicro_v2/web/merchant



	file_server * {
		root /var/www/html

        @nacos path /nacos /nacos*
        reverse_proxy @nacos {
            header_up Host {http.reverse_proxy.upstream.hostport}
            header_down Access-Control-Allow-Origin *
            header_down Access-Control-Allow-Methods GET,POST,OPTIONS
            header_down Access-Control-Allow-Headers *


3. The problem I’m having:

Caddy Log time is not CentOS7 time, time synchronization. Make caddy time consistent with OS time.

4. Error messages and/or full log output:


2022/11/23 06:12:54.999	info	admin.api	received request	{"method": "POST", "host": "localhost:2019", "uri": "/stop", "remote_ip": "", "remote_port": "45188", "headers": {"Accept-Encoding":["gzip"],"Content-Length":["0"],"Origin":["http://localhost:2019"],"User-Agent":["Go-http-client/1.1"]}}
2022/11/23 06:12:54.999	warn	admin.api	exiting; byeee!! 👋
2022/11/23 06:12:55.000	info	tls.cache.maintenance	stopped background certificate maintenance	{"cache": "0xc000393420"}
2022/11/23 06:12:55.001	info	admin	stopped previous server	{"address": "localhost:2019"}
2022/11/23 06:12:55.001	info	admin.api	shutdown complete	{"exit_code": 0}
2022/11/23 06:39:08.048	info	http.log.access.log0	handled request	{"request": {"remote_ip": "", "remote_port": "46812", "proto": "HTTP/1.1", "method": "GET", "host": "", "uri": "/nacos/", "headers": {"Accept": ["*/*"], "User-Agent": ["curl/7.29.0"]}, "tls": {"resumed": false, "version": 771, "cipher_suite": 49195, "proto": "", "server_name": ""}}, "user_id": "", "duration": 0.002804804, "size": 2624, "status": 200, "resp_headers": {"Content-Language": ["en-US"], "Content-Type": ["text/html;charset=UTF-8"], "Last-Modified": ["Wed, 28 Jul 2021 11:28:44 GMT"], "Accept-Ranges": ["bytes"], "Date": ["Wed, 23 Nov 2022 06:39:07 GMT"], "Content-Length": ["2624"], "Server": ["Caddy"], "Alt-Svc": ["h3=\":443\"; ma=2592000"]}}

journalctl --no-pager -u caddy

Nov 23 15:31:14 VM-8-9-centos caddy[31058]: {"level":"info","ts":1669188674.4583886,"msg":"autosaved config (load with --resume flag)","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Nov 23 15:31:14 VM-8-9-centos caddy[31058]: {"level":"info","ts":1669188674.4584343,"msg":"serving initial configuration"}
Nov 23 15:31:14 VM-8-9-centos caddy[31058]: {"level":"info","ts":1669188674.458686,"logger":"tls","msg":"finished cleaning storage units"}
Nov 23 15:31:37 VM-8-9-centos caddy[31058]: 2022-11-23 15:31:37.23030674 +0800 CST m=+22.796086578 write error: can't rename log file: rename /etc/caddy/logs/caddy2.log /etc/caddy/logs/caddy2-2022-11-23T07-31-37.230.log: read-only file system

5. What I already tried:

i have aready assigned write permission to caddy2.log, but it was not work well.

6. Links to relevant resources:

fix log diretory , /var/log/caddy

	log {
		output file /var/log/caddy/info.log {
                    roll_size 30MiB

                    roll_keep_for 30d


		level INFO

then fix its permission

chown caddy:caddy /var/log/caddy

format log console

	log {
		output file /var/log/caddy/info.log {
			roll_size 100MiB

			roll_keep_for 30d


		format console {
			time_format wall


		level INFO

output logfile

2022/11/24 12:02:02	INFO	admin	stopped previous server	{"address": "localhost:2019"}
2022/11/24 12:02:02	INFO	shutdown complete	{"signal": "SIGTERM", "exit_code": 0}