Automatic log rolling in openshift? - openshift

I just created a free php gear...
Is the instance automatically configured to roll logs and delete old logs (to make sure we dont go over disk quota?)
Can you pls tell me how often logs are rolled and when old ones get deleted?
thanks

At this moment (April 2014), Apache RotateLogs does not seem to be used anymore. This commit seems to have changed to use logshifter, which reportedly seems to default to rotating every 10MB with a max of 10 log files.
So, to answer your question, it seems like things are automatically configured to roll logs and delete old logs to prevent us from going over disk quota.
BTW, the new logshifter setup combines the access_log and error_log into one log file instead of keeping them separate.

At this moment (Feb 2014), all OpenShift Apache-based cartridges use Apache RotateLogs program to rotate logs every midnight:
/usr/sbin/rotatelogs <gear-dir>/php/logs/access_log-%Y%m%d-%H%M%S-%Z 86400
The log files are not deleted automatically. However, you can delete them manually using rhc app-tidy <app> command. (Read more about rhc tools.)
If concerned about logs eating all your gear capacity, you might consider using monit community cartridge to trigger automatic email notifications when the app hits 80% of gear storage quota, or to tidy your app automatically. If you already created your app, you can add the monit cartridge with the following commands:
rhc env set MONIT_ALERT_EMAIL=my#email.com -a YOUR_APP
rhc cartridge-add http://goo.gl/jiIB2C -a YOUR_APP
And last but not least, feel free to open a new bug report or new feature request for OpenShift.

Related

Google compute engine, instance dead? How to reach?

I have a small instance running in GCE, had some troubles with the MongoDb so after some tries decided to reset the instance. But... it didn't seem to come back online. So i stopped the instance and restarted it.
It is an Bitnami MEAN stack which starts apache and stuff at startup.
But... i can't reach the instance! No SCP, no SSH, no webservice running. When i try to connect via SSH (in GCE) it times out, cant make connection on port 22. In the information it says 'The instance is booting up and sshd is not running yet', which is possible of course.... But i cant reach the instance in no possible manner not even after an hour wait :) Not sure what's happening if i cant connect to it somehow :(
There is some activity in the console... some CPU usage, mostly 0%, some incomming traffic but no outgoing...
I hope someone can give me a hint here!
Update 1
After the helpfull tip form Serhii... if found this in the logs...
Booting from Hard Disk 0...
[ 0.872447] piix4_smbus 0000:00:01.3: SMBus base address uninitialized - upgrade BIOS or use force_addr=0xaddr
/dev/sda1 contains a file system with errors, check forced.
/dev/sda1: Inodes that were part of a corrupted orphan linked list found.
/dev/sda1: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
(i.e., without -a or -p options)
fsck exited with status code 4
The root filesystem on /dev/sda1 requires a manual fsck
Update 2...
So, i need to fsck the drive...
Created a snapshot, made a new disk from that snapshot, added the new disk as an extra disk to another instance. Now that instance wont boot with the same problem... removing the extra disk fixed it again. So adding the disk makes it crash even though it isn't the boot-disk?
First, have a look at the Compute Engine -> VM instances -> NAME_OF_YOUR_VM -> Logs -> Serial port 1 (console) and try to find errors and warnings that could be connected to lack of free space or SSH. It'll be helpful if you updated your post by providing this information. In case if your instance run out of free space follow this instructions.
You can try to connect to your VM via Serial console by following this guide, but keep in mind that:
The interactive serial console does not support IP-based access
restrictions such as IP whitelists. If you enable the interactive
serial console on an instance, clients can attempt to connect to that
instance from any IP address.
more details you can find in the documentation.
Have a look at the Troubleshooting SSH guide and Known issues for SSH in browser. In addition, Google provides a troubleshooting script for Compute Engine to identify issues with SSH login/accessibility of your Linux based instance.
If you still have a problem try to use your disk on a new instance.
EDIT It looks like your test VM is trying to boot from the disk that you created from the snapshot. Try to follow this guide.
If you still have a problem, you can try to recreate the boot disk from a snapshot to resize it.

google compute engine how to recovery to 2 hours ago?

System is CentOS 7 i dont know why the /bin file missing, i cant login with ssh now.
The programs I spent a week making were all inside, no backups.
So this matter is very important to me.
Does anyone know how to restore data from a hard drive to a specific point in time?
Taking snapshots will allow you to backup your data. Now, for the process of recovery you may have a look at this documentation which will guide you in creating an instance with a snapshot taken previously.
If you cannot login via SSH, you may also try to gain access by interacting with serial console. Here are the steps:
1). Activate the “Connect to serial console” button.
Go to VM instances, click on your VM, Edit, and active “enable connecting to serial ports” in the Remote access area and click on save.
2). Create a username and password.
Go to Vm instance, click on your Vm again, Edit, and fill up the custom metadata section with:
In key: startup-script
In value:
#!/bin/bash
sudo useradd -G sudo pamela
sudo echo 'pamela:pamela5' | chpasswd
(This is a script that creates a username : pamela and password: pamela5, which you are going to use later. Please use something else for security purposes)
3). Reboot for changes to take effect.

Couchbase System logs enable configuration

I am trying to do Circular log enable for system logs in Couchbase DB but not able to know how to enable.
Reason for doing this that Might be after sometime log size will increase due to huge amount of logs.So I am looking something like after 1 month system log should be overwrite. Is there any suggestion or someone already done this will be great help.
I don't see any particular setting in the documentations to accomplish exactly this. But you can change the the log file location. So you could create a script that runs monthly that changes the log file location and deletes the logs in the old location.
From the documentation:
To change the log file configuration:
Log in as root or sudo and navigate to the directory where you installed Couchbase. For example:
/opt/couchbase/etc/couchbase/static_config
Edit the static_config file and change the error_logger_mf_dir variable to a different directory. For example: {error_logger_mf_dir,
"/home/user/cb/opt/couchbase/var/lib/couchbase/logs"}
Restart the Couchbase service. After restarting the Couchbase service, all subsequent logs will be in the new directory.

Openshift, disk quota exceeded

After restarting application I get:
Starting MySQL 5.5 cartridge MySQL server failed to start:
Error writing to temporary file cat:
/var/lib/openshift/.../app-root/logs//mysql.log:
No such file or directoryWarning: Gear
... is using 100.0% of disk quotaFailed
to execute: 'control restart' for
/var/lib/openshift/.../mysql
Also I was trying to stop and start app from rhc commands. The app is not so big to realy fill all of the disk quota. Any advice how to resolve this?
App is working but https://app-name.rhcloud.com/phpmyadmin/ results in
Service Temporarily Unavailable The server is temporarily unable to
service your request due to maintenance downtime or capacity problems.
Please try again later.
You can check my answer here
This usually happen when you app take almost all the space of the quota.
Check all log and temp folder and make the empty if not necessary.
To check how much you are using use quota -s after ssh to the app directory
also for me deleting the content of the app-log folder worked like charm.

How force jenkins to upload another jenkins file in project?

Hello is it possible to work with two jenkins?
Jenkins slave do dirty job, and save image, then he upload to jenkins master. Or jenkins master download from slave. What would be the easiest way to do sthing like this?
ps. i dont know how tag this topic/help
edit1: I mean about working with two computers in the same network. I tried some with manage jenkins > new nodes but with no success. I will report if i will success.
edit2
Okay i set up slave to work by JWS, and tied to project. Then build project to refresh configuration. Now i have problem with port listening by slave but i think i will have to ask admin to unlock. I gues unlock number which value is above 60.000.
I still don't know how use slave to do something and upload to master workspace /or/ use slave to save data in his temp and force master to grab this data from slave.Ant suggestion will be helpful.
Michal,
You don't need two instances of Jenkins to get information from the slave to the master. There are plugins for that.
===========================================================
There are two ways to add a Windows slave:
by service
by JNLP (this should work for sure)
Once you have a slave connected, install the following plugin:
https://wiki.jenkins-ci.org/display/JENKINS/Copy+Artifact+Plugin
===========================================================
Once this is done, set up two jobs. The first job runs on your slave (restrict where this job is run), and make it run your Windows XP program and store the image. Archive this file as an artifact.
On the second job, use the plugin above to copy the artifact from the first job, and use the data in the file as you need it.
For more information, look at the links below:
Restricting jobs to a slave: https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds
Using the copy plugin: https://wiki.jenkins-ci.org/display/JENKINS/Copy+Artifact+Plugin
Archiving an artifact: Archive the artifacts in hudson/jenkins (the first picture in the question should be useful)
===========================================================