
我一直在互聯網上搜尋與 syslog-ng 相關的答案,以及如何配置 syslog-ng 將帶有特定後綴的傳入日誌檔案保存到檔案中,並保留後綴變數。
destination d_logs {
file("/var/log/app-${host}.log", owner("root"), group("root"), perm(0640));
}
在上面的配置中,我希望能夠提取後綴並將後綴傳遞給 syslog-ng 已知的變量,這可能嗎?
閱讀文檔,我們有可能使用解析器,老實說,我不想進行太多解析,只需獲取已知後綴並將其作為文件對象理解的新變量放入即可。
提前致謝並注意安全
答案1
我找到了答案
In the destination you will use a python module and refer to a python class that will parse the incoming message and use the information to write to the specific file.