Logger to a file other that /var/log/system.log



  • I've looked in the documentation and failed to find an answer to this, if I'm blind please point me to where my google-fu failed. Likewise if its somewhere on these boards.

    I'd like to log certain messages to a different file than the standard system.log. Specifically I want to occasionally put a line in /var/log/filter.log so that I can tell when I last looked at it. I tried the naive

    logger -f /var/log/filter.log "message"
    

    which would work on quite a few BSD & Linux systems but in pfsense 2.0 the -f parameter appears to be ignored and the message is written to system.log no matter what.

    Any assistance much appreciated

    Francis



  • OK someone figured this out for me. For others that may be interested the trick is to figure out which syslog facilities/priorities go to the right log file.

    I want filter.log and local0.* goes there so

    
    : logger -p local0.info "this is my test message"
    : clog /var/log/filter.log | tail -1
    Dec 12 05:13:09 pfSense root: this is my test message
    
    

  • Rebel Alliance Developer Netgate

    (I was working up a reply, and you responded before I could hit submit… but there is still something I can add:

    You can also control the tag, or get a message in from another command like so:

    echo Hello World | logger -t mytag -p local0.info
    

Log in to reply