RumbleFish
RumbleFish

Reputation: 2506

Clear log files on OpenShift - RedHat

Debugging my apps on OpenShift is becoming difficult due to excessive log data. I'm using the terminal command rhc tail -a appname to view logs

Is there a way to clear the log files via a rhc command? (or any other method)

Any other recommendations for viewing / handling log data on OpenShift?

Upvotes: 3

Views: 3810

Answers (2)

eddyparkinson
eddyparkinson

Reputation: 3700

Configure logs

To set

  • maximum file size
  • maximum number of files

The maximum file size and maximum number of files can be configured with the LOGSHIFTER__MAX_FILESIZE and LOGSHIFTER__MAX_FILES environment variables.

$ rhc env set LOGSHIFTER_PHP_MAX_FILESIZE=5M LOGSHIFTER_PHP_MAX_FILES=5 -a myapp
Setting environment variable(s) ... done
$ rhc app stop
RESULT:
myapp stopped
$ rhc app start
RESULT:
myapp started

The exact variable names depend on the type of cartridge; the value of is DIY, JBOSSAS, JBOSSEAP, JBOSSEWS, JENKINS, MONGODB, MYSQL, NODEJS, PERL, PHP, POSTGRESQL, PYTHON, or RUBY as appropriate.

copied from: https://developers.openshift.com/managing-your-applications/log-files.html https://developers.openshift.com/managing-your-applications/environment-variables.html

Upvotes: 1

Jiri Fiala
Jiri Fiala

Reputation: 1400

You can use rhc app-tidy <yorApp> to delete the logs and contents of the /tmp directory on the gears (this is used primarily in order to free up some disk space).

You can also ssh into your app rhc ssh <yourApp> and check individual logs in ~/app-root/logs/, which may bring some clarity if you are reading only the log that interests you.

Upvotes: 5

Related Questions