3

On Ubuntu 12.04 how can I configure cron to log to a particular file when it runs jobs as a particular user? I am interested in redirecting both the messages that go into auth.log and those going into syslog.

  • 3
    In this case you actually need to configure your logging daemon, not cron. Cron just sends it's messages to syslog, and then your log daemon determines what file to go into. You can configure your log daemon to extract the user from the message and change the destination based on the user. – Patrick Apr 3 '13 at 19:57
  • 1
    @Patrick could you elaborate your last sentence please? – lalebarde Sep 24 '18 at 16:41
  • 1
    @lalebarde yeah, at the time of the comment I also didn't find it very helpful. By now I know, that several logging daemons, such as rsyslogd allow you to configure where messages end up, based on where they come from or what user logged them. – 0xC0000022L Sep 25 '18 at 8:43
  • Great, but auditd has no option for this and it is the provider of admins logs instead of syslog family – lalebarde Sep 25 '18 at 9:46
  • @0xC0000022L auditd can be chained with rsyslog, then your solution should work – lalebarde Sep 26 '18 at 14:31

Your Answer

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

Browse other questions tagged or ask your own question.