Search code examples
loggingsupervisord

How does `supervisorctl tail` work, for a given process?


Where does supervisorctl tail take the log information of a certain process from? How do I get a full log?


Solution

  • From the command line help (supervisorctl help tail):

    tail [-f] <name> [stdout|stderr] (default stdout)
    Ex:
    tail -f <name>          Continuous tail of named process stdout
                            Ctrl-C to exit.
    tail -100 <name>        last 100 *bytes* of process stdout
    tail <name> stderr      last 1600 *bytes* of process stderr
    

    So by default, the tail command tails the process stdout. If you need to get the full log, the stdout_logfile option of the [program:x] section determines where that is stored; there is a stderr_logfile option as well.

    If that option is not set or set to AUTO, a logfile will be created when the process starts, but cleaned up whenever supervisord restarts. This file is created in the directory set by the [supervisord] childlogdir option (which is your platform's TMP directory by default), and have a generated filename of the form <program-name>-<stdout|stderr>---<supervisor-identifier>-<6-random-characters>.log, e.g. varnish-stdout---supervisor-AqY52e.log.

    Thus, if you want to access the whole stdout log, you need to at the very least set the childlogdir option to a fixed directory to save you from having to search for the right temporary directory.