I am using screen within a deployment script to launch several processes detached.

For example :

/usr/bin/screen -dmSL ${USER}_selenuim java -jar selenium-server-standalone.jar -role hub -servlets com.example.local

The problem I see is that this service will be on for an extended duration and the output is quite verbose as per a requirement however, the log file which is created (screenlog.0) is growing an an extremely large amount.

Is it possible to split this log file or create another log file after it reaches a certain size WITHOUT stopping and restarting the screen services. Or some other combination to reduce the file sizes of logs.

I have referred to the screen Manual however I could not find an answer..

2 Answers 2


My version of screen opens the log file in append mode, so any writes are always at the end of the current size of the file.

This means you can independently reduce the size of the file, for example to 0, and the logs will continue from there. You can use the command

truncate --size 0 screenlog.0

to shrink the file back to size 0. You could copy the contents of the file first if you want to preserve them. Sadly there would be an small interval between the copy and the truncate when new data might be added and would be lost. You could issue the signals SIGSTOP and SIGCONT on your process or the screen process to temporarily pause them whilst you do the copy and truncate.


Create a named fifo with mkfifo, set this as logfile. Now you can read the fifo with another process and put into multiple files matching any criteria.

You must log in to answer this question.

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