Log output of GNU screen in real time?

12,201

Solution 1

It depends what you mean by realtime. The log function for screen can dump the session every second. From the manual:

Command: logfile filename

Command: logfile flush secs

Defines the name the log files will get. The default is ‘screenlog.%n’. The second form changes the number of seconds screen will wait before flushing the logfile buffer to the file-system. The default value is 10 seconds.

Solution 2

If you press C-a H screen will start recording everything to a file called screenlog.X (where X is a number starting at 0).

Share:
12,201

Related videos on Youtube

VoidWhisperer
Author by

VoidWhisperer

Updated on September 18, 2022

Comments

  • VoidWhisperer
    VoidWhisperer over 1 year

    I'm trying to get the output of a GNU Screen to a log file in real time. I've tried using tee, but that appears to not work with screen. The log function for screen will not work for this as it is not in real time, I'm pretty sure. Any ideas?

  • VoidWhisperer
    VoidWhisperer about 10 years
    By real time I mean whenever an output occurs
  • Stéphane Chazelas
    Stéphane Chazelas about 10 years
    @VoidWhisperer, well then, use logfile flush 0
  • VoidWhisperer
    VoidWhisperer about 10 years
    What exactly would that do, constantly flush the file? That seems like it would put alot of unnecessary load
  • Bruno Finger
    Bruno Finger about 9 years
    Where is this file stored? Is this equivalent to start screen with -L?
  • Bruno Finger
    Bruno Finger about 9 years
    OK, I found out the answer. The file is located on the directory which the screen command was issued, and yes, it is equivalent to -L
  • Trevor Boyd Smith
    Trevor Boyd Smith about 8 years
    FYI calling logfile filename and logfile flush secs changes the behavior of gnu screen logging (i.e. where to save the logfile and what rate to flush to file)... but does not open the logfile and start logging. you still need to do log command or C-a H. Then you will see a message from gnu screen stating the log file has been opened at so and so filename.
  • Peter Mortensen
    Peter Mortensen over 4 years
    But isn't it only written to every 10 seconds (by default)?