尝试使用行说明书,但失败并显示错误



有人使用Line食谱--> https://supermarket.chef.io/cookbooks/line

我正在尝试向 rsyslog.conf 文件添加多行并使用之前建议的行食谱。

食谱内容:

replace_or_add "New Lines" do
path "/etc/rsyslog.conf"
pattern "# ### end of the forwarding rule ###"
line "#audit logn$ModLoad imfilen$InputFileName /var/log/audit/audit.logn$InputFileTag tag_audit_log:n$InputFileStateFile audit_logn$InputFileSeverity infon$InputFileFacility local6n$InputRunFileMonitorn*.*"
end

它失败了

================================================================================================================================================================================================================================================== 对资源"replace_or_add[新行]"执行操作edit时出错 ================================================================================

ArgumentError
-------------
Line #audit log
$ModLoad imfile
$InputFileName /var/log/audit/audit.log
$InputFileTag tag_audit_log:
$InputFileStateFile audit_log
$InputFileSeverity info
$InputFileFacility local6
$InputRunFileMonitor
has embedded EOL characters, not allowed for this resource

我尝试在您的文件中使用 tr -d '' <.txt如如何从文本文件中删除换行符中所述? 但它仍然失败并出现相同的错误。 但它仍然以相同的错误失败。

有人测试了行食谱,用于向 rsysconfig 文件添加多行,甚至使用此食谱向文件添加多行??

谢谢 阿尼什

它不是文件,您的line值中有n个字符。一次一行。尝试poise-file可能。

编辑:

另外,srsly不要这样做,就像我上次告诉你的那样。Rsyslog 支持诸如$IncludeConfig /etc/rsyslog.d/之类的功能,它允许从多个离散文件中提取配置。请改用它。

相关内容

最新更新