Shell – What do you use the -t “tag” option for in logger

loggershell-scriptsyslog

When using the "logger" command to write messages to the system logs from scripts, I use the -t "tag" to store the scripts name along side the message it's written to the log.

I do this to make finding entries easier for troubleshooting.

  • Are there any ad-hoc standards for using this tag message?
  • If you use it, what do you put in there?

Best Answer

You're doing it right. Most people that I know use the script or program name with -t, such that log entries are easy to search. Exactly the way you are doing it.

I use it the same way. Occasionally, I will use the username of a person that called a script instead of the script name, but that's for specific cases.

As long as you're using it in a way that makes your log entries recognizable, keep doing it that way.

Related Question