Tomcat's logs is empty after rotating - AWS EC2 - Tomcat 8 - amazon-web-services

Every Tomcat's logs is empty. When I access EC2 with console on the /var/log/tomcat8 dir, every log file is empty with 0kb.
I already tried to change the logrotate.elasticbeanstalk.tomcat8.conf, but without success.
This is the entire logrotate.elasticbeanstalk.tomcat8.conf file as I already tried to change.
/var/log/tomcat8/* {
size 10M
rotate 5
missingok
compress
notifempty
dateext
dateformat %s
olddir /var/log/tomcat8/rotated
}
This is how Tomcat's log file look:
-rw-r--r-- 1 tomcat tomcat 0 Jul 18 00:01 catalina.2019-07-17.log
-rw-r--r-- 1 tomcat tomcat 0 Jul 18 17:01 catalina.2019-07-18.log
-rw-r--r-- 1 tomcat tomcat 0 Jul 19 19:01 catalina.2019-07-19.log

Look in the rotated subdirectory for .gz files with the same filename as a prefix. E.g., catalina.2019-07-17*.gz

Related

Synbolik link to aws EFS on web server doesn't work?

I have static folder serving the files on uwsgi.
/user/app/static/
lrwxrwxrwx 1 root root 23 Oct 13 09:40 _out -> /usr/src/app/_mat/_out/
drwxr-xr-x 8 root root 4096 Oct 13 09:49 assets
drwxr-xr-x 8 root root 4096 Oct 13 09:40 pages
in this case, the imagefiles under assets can be appeared correctly,
however the image files under _out can not be accessed.(404 error occurs)
static/assets/test.png is ok
static/_out/test.png returns 404 error
/usr/src/app/_mat/ are on the aws EFS.
I checked the permissions.
Generally speaking, does symbolic link work under web server?

error: error creating output file /var/lib/logrotate.status.tmp: Permission denied

I am trying to logrotate my log files. Here is my configuration file:
/home/deploy/apps/production_app/current/log/*.log {
daily
missingok
rotate 52
compress
create 0644 deploy deploy
delaycompress
notifempty
sharedscripts
copytruncate
}
And this is result of
ll apps/production_app/current/log/
on my log files:
-rw-rw-r-- 1 deploy deploy 0 Jul 1 10:01 production.log
-rw-rw-r-- 1 deploy deploy 1124555 Jul 1 10:01 production.log.1
And when I run this command
logrotate -v /etc/logrotate.d/production_app
I get following:
error: error creating output file /var/lib/logrotate.status.tmp:
Permission denied
And here is permission on my log-rotate config file
lrwxrwxrwx 1 root root 67 Feb 25 2019 /etc/logrotate.d/production_app -> /home/deploy/apps/production_app/shared/config/log_rotation
please check whether the dir "var/lib" is readonly.

docker socker at /var/run/docker.sock with AWS

I have an issue where a few tools, Portainer for example, can't find the docker socket on AWS.
I have some setup scripts that were run to set various containers.
On MacOS, it works without problems.
On a CentOS box, no problem as well.
On CentOS / AWS, containers cannot connect to the docker socket.
I am talking about a local unsecured connection to /var/run/docker.sock
What could be different on AWS?
I can see the socket:
➜ run ls -ld /var/run/docker*
drwxr-xr-x 8 root root 200 Nov 27 14:04 /var/run/docker
-rw-r--r-- 1 root root 4 Nov 27 14:03 /var/run/docker.pid
srw-rw-r-- 1 root docker 0 Nov 27 14:03 /var/run/docker.sock

What is the default user that codedeploy runs the hook scripts as?

Background: I am facing this error AWS codedeploy deployment throwing "[stderr] Could not open input file" while trying to invoke a php file from the sh file at afterInstall step
In the afterInstall step, I am trying to run a php file from the afterInstall.sh file and I am getting this error - unable to open php file.
I am not sure what exactly to do. Thought of trying to manually check if I could run the file as that user.
The CodeDeploy agent default user is root.
The directory listing below shows the ownership of the deployed files in their destination folder, /tmp, after a successful deployment.
ubuntu#ip-10-0-xx-xx:~$ ls -l /tmp
total 36
-rw-r--r-- 1 root root 85 Aug 2 05:04 afterInstall.php
-rw-r--r-- 1 root root 78 Aug 2 05:04 afterInstall.sh
-rw-r--r-- 1 root root 1397 Aug 2 05:04 appspec.yml
-rw------- 1 root root 3189 Aug 2 05:07 codedeploy-agent.update.log
drwx------ 2 root root 16384 Aug 2 03:01 lost+found
-rw-r--r-- 1 root root 63 Aug 2 05:04 out.log
runas is an optional filed in the AppSpec file. The user to impersonate when running the script. By default, this is the AWS CodeDeploy agent running on the instance(If you don't specify a non-root user, it will be root).
To run host agent as a non-root user, the environment variable CODEDEPLOY_USER needs to be set, as the link to the host agent source code show. The env variable can be set to whatever user you want the host agent to run as.

Google PageSpeed Apache Error log CentOS

I installed the Google PageSpeed module to my CentOS 7.0 DA VPS.
I used this blog, by installing the PageSpeed module: http://www.haloseeker.com/install-go...h-directadmin/
When I check my Apache Error Log, I found the following errors:
[pagespeed:error] [pid 2593] [mod_pagespeed 1.11.33.1-0 #2593] Could not create directories for file /var/cache/mod_pagespeed/v3/domain.com/https,3A/,2Fwww.domain.com/icon_feed.gif,.temp
[pagespeed:error] [pid 2593] [mod_pagespeed 1.11.33.1-0 #2593] /var/cache/mod_pagespeed/v3/domain.com/https,3A/,2Fwww.domain.com/icon_feed.gif,.temp8f2OKe:0: opening temp file: No such file or directory
[pagespeed:error] [pid 2673] [mod_pagespeed 1.11.33.1-0 #2673] Failed to make directory /var/cache/mod_pagespeed/v3/domain.com/https,3A/,www.domain.com/images: Permission denied
How can I solve this problem?
Try to update your directory permission with the following command and let me know if you have any issues.
chmod -R a+w /var/cache/mod_pagespeed
This doesn't have to work. Depending on the Apache configuration (mpm_itk), it's possible that each vhost is served as another user.
So important directories are made under user A, and when another request to host B, user B cannot delete/create subdirectories.
I haven't figured out how to solve this, running CentOS and cPanel as hoster.
-rw-------. 1 tvr86nl tvr86nl 13 Aug 17 23:14 !clean!time!
drwxr-xr-x. 4 tvr86nl tvr86nl 37 Aug 17 00:45 prop_page
drwxr-xr-x. 12 tvr86nl tvr86nl 4.0K Aug 17 12:54 rname
drwxr-xr-x. 3 tvr86nl tvr86nl 22 Aug 16 18:16 v3
root#vps1.sse-ict.nl /var/mod_pagespeed/cache>
so this happens every time when these directories are created :(
perhaps a cron-job would do the trick. But it's a mod_pagespeed
shortcoming!