AWS EC2 apache log file location on AMI - linux

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.

Related

Spring Tool Suite 3.8.2 - Installation on Ubuntu

I managed to install STS 3.8.2 on Ubuntu 16.04 - with a lot of hacking experiments. I have it working, but I am not happy with my solution.
Here is what I had to do:
Extracted the tar file into /opt/sts-bundle.
If you put it anywhere else, like /opt/sts, the TC server fails to start from STS.
With files in /opt/sts-bundle, TC server still fails to start from STS - permission errors. To get it to work you need to futz around with permissions of the pivotal-c-server subdirectories, essentially you need to open it up your group (the same one running STS) (security hole ?).
A local install in your own ~/sts-bundle fails on "files not found" while attempting to backup - all the conf files. It still looks in /opt/sts-bundle for all these config files (just to copy them to /backup). You can change the top directory of the server in STS server properties - but it still looks in /opt/sts-bundle. Seems hard-coded - don't know where. So you have to create all the config files in the conf directory in the tree rooted at /opt/sts-bundle ("touch" works - creating empty files). TC Server still fails to start with a "failed to clean" error - with no clue from the detailed message what files are being "cleaned".
I tried creating a non-privileged user "tcserver" per suggestion from the Pivotal TC Server docs. I installed to /opt/sts-bundle, while logged in as tcserver (with sudo privileges). That fails when I am using STS as a regular developer that is not "tcserver". Could not figure out how to tell TC server to run under a different user than the one that started STS.
The solution I have working and I am not happy with, starts by extracting the tar.gz file into /opt/sts-bundle, as it wants. Then changing owner and group of sts-bundle to my id and my group (same ones that are used in STS UI). I am not happy with that. It seems wrong to put things in /opt that are owned by a single developer.
I am new to Linux, and I still have some Windows habits that need to be unlearned.
The question is: how do I get the clean solution (installing using a "tcserver" user in the global /opt directory) to work for developers who are not "tcserver"? How should the tcserver user be related to the developers (same group?).
Am I making this problem harder than it should be? What am I missing?
I'm not sure this what you want, but I don't install the STS bundles in some kind of shared directory as a special user at all. I just install it in my user.home dir, as myself, and launch it from there.
It is very unsophisticated. I just download the tar.gz file, unpack it in my home dir and then launch it from a trivial bash script which looks something like this:
#!/bin/bash
/home/kdvolder/Applications/sts-bundle/sts-*/STS
That script is on my PATH. So I can just type 'STS' in a terminal and STS will start.
I don't have to do anything else and it works.
If you are trying to somehow install this so that several different users can run a shared installation then this isn't a good setup. But I think for your own personal laptop or desktop which only you are using, this simple setup is perfectly fine.
For a shared-user env, unfortunately, I don't know how to help you. It could be complicated to sort out all the permissions issues etc because Eclipse is a complicated beast w.r.t to installation of plugins etc.

How to recover overwritten bash profile

I installed homebrew with brew install wget and when I opened my .bash_profile it was some file I had never seen before full of homebrew's things. My aliases are still working, but I was wondering where I could find them since they're not in the txt file anymore.
I am not familiar with OSX, but I guess your old bash settings could have been backed up somewhere, because your aliases are still working. Try searching for files/directories named "bash*".
you should try using a file recovery program. it is possible the alias is referring to the location on the HDD and that the file still exists, even if the file with that name isn't accessible anymore.
a file recovery program may be a good option.

Custom InstallAnywhere location for .com.zerog.registry.xml file on linux

I'm running into an issue where I do not have write access to the /var directory on a UNIX environment, and InstallAnywhere doesn't provide me the option of writing the .com.zerog.registry.xml to any other location for a product installation. Is there a parameter out there that allows for this file to be written to a different directory?
According to the IA docs:
If logged in as root, the global registry is located in \var.
If logged in as a user, it is located in the user’s home directory.
So, if you're running as root and can't write to /var, it sounds like a permissions problem with the /var directory, independent of IA. Check the permissions on /var.
If you're running as a non-root user, then the registry shouldn't be going to /var, but to $HOME/.com.zerog.registry.xml (FWIW, I just checked one of our test Linux boxes and found .com.zerog.registry.xml under both /var and under test-user $HOME directories. The docs appear to be correct).
I've also seen some very strange behavior if IA is low on space in $TMP. Make sure you have plenty of space there.
Also, have you considered running the installer with sudo, or the graphical equivalents kdesudo (KDE) and gksu (Gnome)? Those might get you where you want to go.

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

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/

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