9

How do you tail openshift log files? I issued the following command:

rhc tail myapp

It seems to show first error line and then stops, but doesn't exit. If I press ctrl+C it asks whether to stop batch or not. How can I display last few errors and may be browse page by page? Is there page down/ page up shortcuts?

timo.rieber
  • 3,727
  • 3
  • 32
  • 47
synergetic
  • 7,756
  • 8
  • 65
  • 106

5 Answers5

6

The 'rhc tail' command reads the last few lines of each of your log files and continues to feed subsequent log messages to your console. To view the entire log file, please review:
https://www.openshift.com/faq/how-to-troubleshoot-application-issues-using-logs

Nam Duong
  • 851
  • 5
  • 4
  • 1
    Went there but left wondering how to download them - I use notepad++ and I'd rather edit them locally - add that info there please (see my answer) – Mr_and_Mrs_D May 26 '14 at 22:08
5

you can see by running:

rhc tail -a yourappname -l youremail -p yourpassword
suhailvs
  • 20,182
  • 14
  • 100
  • 98
  • This works, but shows logs 'live'. Can be handy when something goes wrong; issue this command then execute the failing action and watch the logs as they are written. If you just want to browse log files, either ssh into the server and view logs there (using `cat`, `tail`, `grep`, `vi` etc) or (my personal favorite) configure FTP over ssh and just download the log files and open in your favorite editor. – Stijn de Witt Feb 17 '17 at 22:30
2

Adding -a option fix this issue for me.

rhc tail -a {app_name}
Khaled Lela
  • 7,831
  • 6
  • 45
  • 73
1

Openshift place logs in different files, so if you want get logs of a specific file then you can add -f file/address/and/name

Example :

rhc tail -f app-root/logs/nodejs.log -a myAppName

also you can ask for specific number of lines by adding -o "-n 40" in command. Above command will get last 40 lines.

Example :

rhc tail -f app-root/logs/nodejs.log -o "-n 40" -a myAppName

Ali Uzair
  • 11
  • 2
0

You can also download them:

$ scp  SHA@APP-DOMAIN.rhcloud.com:/var/lib/openshift/SHA/app-root/\
logs/APP.log "~/upstream.jbossas.log"

Feasible also in windows directly in git bash.

Mr_and_Mrs_D
  • 32,208
  • 39
  • 178
  • 361