问题描述
嗨,我需要配置文件:
if $FROMHOST-IP == '192.168.xx.xxx' then { action(type="omfile" file="/var/log/rsyslog/myHostName/device.log") }
else {*.* ?RemoteHost}
但是重新启动后的rsyslog给我此消息:
Oct 13 12:12:40 syslog-new rsyslogd[29378]: error during parsing file /etc/rsyslog.conf,on or before line 118: Syntax error on token 'else' [v8.1901.0 try https://www.rsyslog.com/e/2207 ]
Oct 13 12:12:40 syslog-new rsyslogd[29378]: Could not interpret master config file '/etc/rsyslog.conf'. [v8.1901.0 try https://www.rsyslog.com/e/2207 ]
请帮助。 谢谢
解决方法
有关if..then..else的RainerScript文档在细节上有些欠缺,但是为了区分对if
的这种使用与也从()
开始的传统过滤器语法,似乎您需要将表达式括在if ($FROMHOST-IP == '192.168.xx.xxx') then { action(type="omfile" file="/var/log/rsyslog/myHostName/device.log") }
else {*.* ?RemoteHost}
中。试试
**JavaScript**
function check(){
var s = document.getElementById("text").innerHTML;
var c;
c = s.substring(0,s.indexOf('?'));
}
**HTML**
<button id="check" type="submit" onclick="check()">Check</button>
<p id="text"> Hello,what's up with you? Haven't seen you in ages!</p>