EC2 runs out of storage, which logs etc. can be deleted? - linux

I am having a problem with an EC2 which uses nearly all of the 8GB of storage. I regularly delete log files from the server and files which get created by cronjobs in the users folder (can I turn this off?), but in the past there is always less space after deleting all the files. So somewhere else the EC2 creates files, but I don't know where.
Does anybody know where I can look for unused files automatically created by the Amazon Linux AMI or apache?
Thanks!

Look in /var/log, and for Apache they will likely be in /var/log/httpd. I also suggest that you look into logrotate.

You can clear all log files from your ec2 Ubuntu instance using this command
sudo rm -rf /opt/bitnami/apache2/logs/

Related

Running out of space on Linux, copying 12GB of files to a 15GB file system

I have two virtual Linux servers, one for development and one in production, a typical setup one would expect.
On the development server I have files that I need to copy to the production server, that amount to 12GB, well according to the "du -h" command. The production server has 15GB free, according to the "df -h" command. However, when trying to copy the files across, the production server ran out of file space!
Whilst I know that both commands round up or down the answer, there should be still over 2GB free at the end, 12.4GB to 14.5GB. Equally, there could be near 4GB as well, 11.5GB to 15.4GB. (For some reason, I get slightly different answers based upon the user, but still enough to fit the files - supposedly.)
Both servers are running 64 bit Ubuntu 16.04 LTS and have the file system set as EXT4.
I'm using SCP to copy the files across, since I don't have enough space to contain a zipped file and its unzipped contents.
So what am I missing?
Please try the same with rsync command in terminal. Here is the example of it.
$ rsync -a /some/path/to/src/ /other/path/to/dest/

how to run two instances of couchDB in the same linux physical machine

I would like to have two couchdb server running on my machine.
I have already one instance running installed via this command line
sudo apt-get install couchdb -y
I can run it and stop it via
/etc/init.d/couchdb [start|stop|restart]
how can I have another instance of couchdb running on a different port
OS : linux 16.04
You can use a different configuration file to start a second instance with. This is definitively an advanced topic, as you must take extra care that different instances of couchdb don't share any data, log or configuration files. You find some information about configuration in the CouchDB docs. You could start with duplicating the startup script (/etc/init.d/couchdb) and adapting the folders there, then copying the local.ini from the config folder and changing the data folders, http port and other configuration there.
I used this (quite old) build script to install completely separate copies and found it easier to work with.
But nowadays I would just use Docker and install several CouchDB containers, preferably with the klaemo/couchdb image which is easy to handle.

LS command not listing files in Amazon EC2

I'm using an Amazon ec2 instance and am SSHed into it. For some reason when I use the ls command, it doesn't list the files in the current directory. Is this command disabled by default? if so, is there a way to enable it?
The issue was that I was in the ~ folder. Once I cd into the html folder, i was able to list the files. Could also be a permissions thing because i have permissions in the html folder

AWS EC2 apache log file location on AMI

I'm learning about AWS and EC2. I set up a AMI linux box that is running apache and mysql setup from yum. It was working for a bit, but now its flatlined. This is strange, so I thought to go check the logs. I'm moving around via a putty terminal and I cannot find the log files location. Does anyone know there that information is stored. Thanks you for the help.
Edit: I would like to generalize and ask about the location of any important log files that the system creates. This is new stuff to be, so the location of any useful files to better understand what is going on would be helpful.
/var/log directory usually has application and unix logs.
A more general purpose way of finding the log, since a specific file will often be in a different place depending on the installation and version, as I found mine differed from the previous answers:
/var/log/ is the usual location for application logs.
If it is under restrictive permissions, you can do sudo ls /var/log to get a list of files and directories under it to hunt down your query.
Depending on the version of apache, the logs will usually be under either /var/log/apache2 OR /var/log/httpd. Again, if you want to look for what specific file you are looking for under this directory, try sudo ls $location$.
Mine happened to be under /var/log/httpd/error_log from my installation on ec2, but error.log is another common file name.
Older error logs, and the corresponding access logs, are also saved here after they are rotated out, with the timestamp of when the rotation occurred.
The quick way to then view the last 100 or X lines of the file is to use tail -100 /var/log/httpd/error_log.
ubuntu under AWS server
sudo tail -100 /var/log/apache2/error.log
linux
/var/log
If you can't find it at /var/log try /usr/local/apache/logs.

Transferring CouchDB .couch files from Windows to Linux

Am currently working on a CouchDB project, and have recently decided to switch to a Linux environment for development as I plan to deploy on a Linux server.
I was hoping to copy over my .couch files straight from - Program Files/Apache Software Foundation/CouchDB-1-1-1/var/lib/couchdb - and paste them directly into what I guess should be - var/lib/couchdb - But I keep running into file/folder permission errors each time I try to access var/lib/couchdb.
Is it even possible to transfer .couch files in the way I envisage?
...
Update - Follwing up on Dominic's comments, I managed to apply the fix found in the answer below.
After some investigative work, I found it to be a permissions error, exactly as Dominic Barnes had suggested in the comments...
The issue is also discussed here - Staging setup with couchdb
To fix it, I first ran;
sudo chmod -R 755 var/lib/couchdb
I may have also changed the permissions on the relevant parent folders too. I was then able to copy my .couch files into var/lib/couchdb/COUCH-VERSION-NUMBER. After doing that, I then had to use chmod to set favourable write permissions on the newly copied files, but also had to run:
sudo chown couchdb var/lib/couchdb/COUCH-VERSION-NUMBER/
To open those files up to the user group (the "couchdb" group) that the couchdb installation sets up for internal use (I think...). After that, I restarted couchdb, forcing it to stop with:
ps -U couchdb -o pid= | xargs kill -9
and restarting with:
/etc/init.d/couchdb start
After that, everything seemed to work as expected.
Hope that helps anyone else running into the same problem.

Resources