rsyslog是否可以创build一个目录?
安装程序 我在/etc/rsyslog.conf有这个: $template local1DynFile,"/path/to/my/log/%programname%.log.%NOW% $template local1LogFormat,"%msg:2:$:%\n" *,*;auth,authpriv,local0,local1.none ~/var/log/syslog local1.* ?local1DynFile;local1LogFormat 然后我有以下Python脚本( test.py ): import logging import logging.handlers logger = logging.getLogger('pxet.foo') logger.addHandler(logging.handlers.SysLogHandler(address='/run/systemd/journal/syslog', facility='local1')) logger.handlers[0].setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG) logger.debug('test cockroach is a bug') 问题 如果我做到以下几点: rm -rf /path/to/my/log systemctl restart rsyslog python test.py 我没有得到日志消息。 然而: mkdir -p /path/to/my/log python test.py 这一切工作。 问题 如果不存在,是否可以让rsyslog创build目录,还是我自己必须这样做?