Share & learn

Through Innovative Digital Library

How to send messages to rsyslog in RHEL7/CentOS7?

Can you share the syntax to send messages to rsyslog in RHEL7/CentOS7?
 



Answers

Posted by Jon Snow on April 23rd 2018 07:53 AM

"logger" command with "-p" option is used to send messages to rsyslog service. Without "-p" option it will send the messages to the facility user with severity notice by default. It is very useful to test the changes to the rsyslog configuration. "-p" - Enter the message into the log with specified priority. Priority may be specified numerically or as a facility level. For example - -p local3.info logs the message as informational in the local3 facility. "tail -1 /path/to/logfile" will display the latest entry of the log file. Lets send messages to rsyslogd that gets recorded in the /var/log/boot.log and /var/log/maillog log file, as shown below:

# logger -p mail.err "User is not authorize"

# tail -1 /var/log/maillog

# logger -p local7.info "Log message from stark"

# tail -1 /var/log/boot.log
Answer Question

Your email address will not be published. Required fields are marked *

  • Minimum 20 character
5ZBS

related questions

Most liked questions

Most answered questions

Login
5ZBS Refresh
Register
5ZBS Refresh
Forgot password
Ask a Question
Minimum 20 character
Minimum 20 character
Reply
Minimum 20 character
5ZBS Refresh