2

I am using a software F, installed on PC named A (192.168.6.5) (running Windows) for receiving log (rsyslog) from a remote Ubuntu 14.04 server B (192.168.6.6). In F, I can see logs from B with types like information, alert, notice...

I made logs in B using logger command:

logger "i am log from B"

When I checking F in A, I can see the above message, like.

ubuntu notice 192.168.6.6 "i am log from B"

When I check the original log file in B, which located at: /var/log/syslog, I can see these lines, but they only have datetime, computerName, messageContent. There are nothing about "info" or "notice". I don't what exact to call it (in F, it is severity). Is there a way to specify it with logger command?

2
  • 1
    You mean like with -p/--priority option?
    – muru
    Jan 5, 2017 at 10:22
  • Yes. Exact it is
    – Andiana
    Jan 5, 2017 at 16:36

1 Answer 1

3

You are looking for the -p (--priority) option, regardless of the name it supports specifying both facility and priority separated by . (by default it uses user.notice).

For example, for logging a message with auth facility and crit priority:

logger -p 'auth.crit' 'Whatever ...'

then check in /var/log/auth.log (default location for logs belonging to the auth facility).

Similar goes for others. For example, for user facility and info priority:

logger -p 'user.info' 'Whatever ...'
3
  • Just a little, is priority information is saved in /var/log/syslog or somewhere? Can I retrieve it later instead of at the logging time only?
    – Andiana
    Jan 6, 2017 at 7:12
  • @Andiana yes, of course. As you're in 14.04, just check where the relevant facility.priority logs are going, from the rsyslog's configuration file, /etc/rsyslog.conf (which should have a include directive to read confs from /etc/rsyslog.d/*.conf files too).
    – heemayl
    Jan 6, 2017 at 7:49
  • FYI for anyone wondering why this isn't working. It doesn't seem to work in Ubuntu 20.04. For example logger -p user.crit -t test 'hello' gives the following in /var/log/user.log: Jul 6 11:24:54 myserver test: hello. Notice the lack of priority...
    – Stiofán
    Jul 6, 2021 at 11:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .