strange symbolic links created in Apache home directory

This has puzzled me quite some time. Beginning a couple of months ago, I have been seeing some strange and broken symbolic links in my Apache home directory, which is /usr/local/apache. You can see them here:

lrwxrwxrwx  1 root root  25 Mar 29 23:04 build;460c7e42 -> ../../usr/lib/httpd/build
lrwxrwxrwx  1 root root  19 Mar 29 23:04 logs;460c7e42 -> ../../var/log/httpd

They are generated daily and each one has a different name. You can see how they are going to pollute the directory.

Cpanel is highly suspected for this. And I talked to the serve tech and the best answer I got is that the files might have been created by Cpanel or some other system procedures.

Finally I accidentally found a solution. I created a symbolic link to /var/log/httpd and named it “logs” and in this way the logs files and file will be written to /var/log/httpd directory instead of Apache home directory. Of course the original logs will need to be removed and renamed and Apache needs to be restarted. Guess what, the strange links stopped showing up.

This made me start suspecting logrotate since it apparently has something to do with the log files. But anyway, I am still have my fingers crossed and hoping this will fix it.

Let me know if you have the similar situation or solutions.

This entry was posted in my 2 cents. Bookmark the permalink.