I have a Node.js server that is being monitored by forever. Forever generates three logfiles: the server STDOUT, STDERR and the log of forever itself.

$ forever -l forever.log -o out.log -e err.log app.js

But instead of logging to logfiles I would like to log everything to syslog, optionally with adding a prefix of some sorts so my syslog processing servers can sort everything out.

On StackOverflow, someone suggested that this can be handled using some bash wrapper and suggested I ask here. So, how would I get those logs into syslog instead of into files?

2 Answers 2


Have you tried using logger with process substitution?

$ forever -a >(logger -t forever) -o >(logger -t app.js) -e >(logger -t app.js) app.js

You can play around with the logger -p switch for specifying log levels, warn, info, err, etc. as well as other logger switches. The forever -l needed to be changed to forever -a.

I tried this with a few of the sample files installed by forever and it worked. Each distro may log to different log file by default, you'll have to experiment with logger switches.

  • Thanks, that sounds perfect! I'll give it a try when I'm back at work on Monday. Mar 3, 2012 at 17:45
  • @SanderMarechal Experiment with logger by itself, figure out which switches will help you, then modify the example to suit. Good luck.
    – bsd
    Mar 3, 2012 at 17:53
  • 1
    This might have worked in the past, but now the -a option does not allow for an argument; i.e. the command must be `forever -a -o >(logger -t app.js) -e >(logger -t app.js) app.js'
    – radiospiel
    Oct 17, 2014 at 14:21
  • Docs: github.com/foreverjs/forever, linux.die.net/man/1/logger
    – Ben
    Sep 22, 2015 at 15:47

With rsyslog you can use the Text File Input Module to monitor log files and process them.


  • 2
    Btw, syslog-ng apparently can do this, too.
    – sr_
    Mar 2, 2012 at 15:11
  • 1
    This is true, but log rotation is more involved this way because the application continues to hold the file descriptors open to log to them, possibly requiring the app to restarted when the logs are rotated. That's not an issue when logging directly to syslog via logger. Jun 29, 2015 at 13:25

You must log in to answer this question.

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