I'am trying to debug a server that throws a lot of logs on stdout/stderr. I need to redirect only last N lines to a file. Something like a rotating buffer feature there in `tcpdump`'s `-C` & `-W` flags. It would be nice if I could view the log while the server is still running and throwing the logs (I could `cp` it in another file to view it). Is there a utility that does this? From my little understanding of `logrotate` tool, it should be run repeatedly. I don't think it fits my need. What I would like is:

```
serverd -d | $TOOL -n 100 srv.log

```

...where at any time `srv.log` contains last 100 lines outputted from `serverd`.