nxlog无法收集某些目录下的日志
Nxlog cannot collect logs in certain directories
背景
使用nxlog收集win server 2012 R2服务器的日志。
配置文件如下
define ROOT C:\Program Files (x86)\nxlog
define CERTDIR %ROOT%\cert
define CONFDIR %ROOT%\conf
define LOGDIR %ROOT%\data
define LOGFILE %LOGDIR%\nxlog.log
LogFile %LOGFILE%
Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
<Extension _syslog>
Module xm_syslog
</Extension>
<Input in1>
Module im_file
ReadFromLast true
SavePos false
File "C:\中文\log.log"
</Input>
<Output out>
Module om_udp
Host 192.168.40.3
Port 514
</Output>
<Route 1>
Path in1 => out
</Route>
进程
如果我们使用后台代码,我们会报错。查看服务器上nxlog的日志,发现如下错误
2020-11-26 10:13:02 ERROR failed to open C:\中文\log.log; Invalid argument
2020-11-26 10:13:04 ERROR apr_stat failed on file C:\中文\log.log; Invalid argument
但是如果我们只使用英文字符串目录。一切都会好起来的。
如
define ROOT C:\Program Files (x86)\nxlog
define CERTDIR %ROOT%\cert
define CONFDIR %ROOT%\conf
define LOGDIR %ROOT%\data
define LOGFILE %LOGDIR%\nxlog.log
LogFile %LOGFILE%
Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
<Extension _syslog>
Module xm_syslog
</Extension>
<Input in1>
Module im_file
ReadFromLast true
SavePos false
File "C:\log.log"
</Input>
<Output out>
Module om_udp
Host 192.168.40.3
Port 514
</Output>
<Route 1>
Path in1 => out
</Route>
问题
如何让nxlog收集非英文字符串目录下的日志?
加时赛
确保conf文件编码为UTF-8
背景
使用nxlog收集win server 2012 R2服务器的日志。 配置文件如下
define ROOT C:\Program Files (x86)\nxlog
define CERTDIR %ROOT%\cert
define CONFDIR %ROOT%\conf
define LOGDIR %ROOT%\data
define LOGFILE %LOGDIR%\nxlog.log
LogFile %LOGFILE%
Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
<Extension _syslog>
Module xm_syslog
</Extension>
<Input in1>
Module im_file
ReadFromLast true
SavePos false
File "C:\中文\log.log"
</Input>
<Output out>
Module om_udp
Host 192.168.40.3
Port 514
</Output>
<Route 1>
Path in1 => out
</Route>
进程
如果我们使用后台代码,我们会报错。查看服务器上nxlog的日志,发现如下错误
2020-11-26 10:13:02 ERROR failed to open C:\中文\log.log; Invalid argument
2020-11-26 10:13:04 ERROR apr_stat failed on file C:\中文\log.log; Invalid argument
但是如果我们只使用英文字符串目录。一切都会好起来的。 如
define ROOT C:\Program Files (x86)\nxlog
define CERTDIR %ROOT%\cert
define CONFDIR %ROOT%\conf
define LOGDIR %ROOT%\data
define LOGFILE %LOGDIR%\nxlog.log
LogFile %LOGFILE%
Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
<Extension _syslog>
Module xm_syslog
</Extension>
<Input in1>
Module im_file
ReadFromLast true
SavePos false
File "C:\log.log"
</Input>
<Output out>
Module om_udp
Host 192.168.40.3
Port 514
</Output>
<Route 1>
Path in1 => out
</Route>
问题
如何让nxlog收集非英文字符串目录下的日志?
加时赛
确保conf文件编码为UTF-8