我想使用日志 - /var/log/message 作为我的日志,我的应用程序名称是 - Whatsapp_man
例如我向日志发送以下警告
[root@worker01 ~]# logger "please noitce you are before attack"
[root@worker01 ~]# tail -1 /var/log/messages
Mar 4 13:28:05 worker01 root: please notice you are before attack
[root@worker01 ~]#
但如何使用记录器来获取whatsapp_man而不是root
正如福林预期的结果
[root@worker01 ~]# logger [....] "please notice you are before attack"
[root@worker01 ~]# tail -1 /var/log/messages
Mar 4 13:28:05 worker01 whatsapp_man: please notice you are before attack
[root@worker01 ~]#
答案1
您要查找的前缀由-t
记录器选项:
logger -t whatsapp_man "..."