I want to tail -f a log file. The application dynamicall names its log files using the date, so each time the app is run the log file looks something like "myapp-2008-01-18-18-29-17-686.log". There are many log files, but I know I just want to tail the last one. I have taken this approach to discover which is the latest:
$ ls -trC1 myapp*.log | tail -1
That displays to stdout the file I am interested in. I cannot figure out if it is possible to somehow pipe that or redirect it somehow as the ARGUMENT of another tail -f command. This does NOT work because the last tail command is just tailing stdin:
$ ls -trC1 myapp*.log | tail -1 | tail -f
Any ideas? I'm open to other suggestions, but I'd like to keep it simple and do it in one line instead of a script...