1

I have OpenShift Enterprise 2.0 running in a multi-node setup. I am running a simple JBoss scaled app (3 gears, so HAProxy and 2 JBoss gears). I have used a pre_start_jbossews script in .openshift/action_hooks to configure verbose GC logging (with just gc.log as the file name). However, I can't figure out how to get the gc.log files from the gears running JBoss.

[Interestingly enough, there is an empty gc.log file in the head/parent gear (running HAProxy). Looks like there is a java process started there, that might be a bug.]

I tried to run

rhc scp <appname> download . jbossews/gc.log --gears

hoping that it would be implemented like the ssh --gears option, but it just tells me 'invalid option'. So my question is, how can I actually download logs from child gears?

timo.rieber
  • 3,727
  • 3
  • 32
  • 47
Randall T.
  • 187
  • 12

3 Answers3

1

I don't think that you can use RHC directly to get what you want.

However you can use the following to find all of your GEARS:

rhc app show APP_NAME --gears | awk '{print $5}' | tail -n +3

From this list you can list all the logs for each gear that are part of that application.

for url in $(rhc app show APP_NAME --gears | awk '{print $5}' | tail -n +3); do for dir in $(ssh $url "ls -R | grep -i log.*:"); do echo -n $url:${dir%?}; echo; done; done 

With that you can us simple scp commands to get the files you need from all of the gears:

for file_dir in $(for url in $(rhc app show APP_NAME --gears | awk '{print $5}' | tail -n +3); do for dir in $(ssh $url "ls -R | grep -i log.*:"); do echo -n $url:${dir%?}; echo; done; done); do scp "$file_dir/*" .; done
Randall T.
  • 187
  • 12
Eric Rich
  • 507
  • 2
  • 7
  • I haven't actually tried your solution above, but I'll accept it anyway. (I already had a workaround involving the root user.) I went ahead and opened a [feature request: https://github.com/openshift/rhc/issues/593](https://github.com/openshift/rhc/issues/593). – Randall T. May 09 '14 at 20:30
1

If you need to download any files, you can use an SFTP client like FileZilla, so you can copy files from the server.

Dilini Rajapaksha
  • 2,610
  • 4
  • 30
  • 41
0

I know it's been a while since the original question was posted, but I just bumped into the same issue today and found that you can use the scp command directly if you know the gear SSH URL:

scp local_file user@gear_ssh:remote_file

to upload a file to the gear, or

scp user@gear_ssh:remote_file local_file

to download from the gear.

Ionut-Cristian Florescu
  • 1,798
  • 1
  • 10
  • 11