0

I want to use the log - /var/log/message for my logs my application name is - whatsapp_man

for example I send the following warning to the log

[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 ~]#

but how to use the logger in order to get whatsapp_man instead of root

as the fowling expected results

[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

The prefix you're looking for is provided by the -t option of logger:

logger -t whatsapp_man "..."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.