Using openshift rhc tail command
Asked Answered
C

5

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?

Chevrette answered 2/7, 2013 at 8:23 Comment(0)
W
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

Wilmerwilmette answered 2/7, 2013 at 15:23 Comment(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)Lerner
C
5

you can see by running:

rhc tail -a yourappname -l youremail -p yourpassword
Cato answered 10/12, 2013 at 7:30 Comment(1)
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.Fujimoto
M
2

Adding -a option fix this issue for me.

rhc tail -a {app_name}
Macropterous answered 7/11, 2015 at 9:33 Comment(0)
L
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

Laodicean answered 28/2, 2016 at 19:51 Comment(0)
L
0

You can also download them:

$ scp  [email protected]:/var/lib/openshift/SHA/app-root/\
logs/APP.log "~/upstream.jbossas.log"

Feasible also in windows directly in git bash.

Lerner answered 26/5, 2014 at 22:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.