質問

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?

役に立ちましたか?

解決

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

他のヒント

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

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top