LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Aliases (https://www.linuxquestions.org/questions/linux-newbie-8/aliases-893191/)

cleibesouza 07-22-2011 01:02 PM

Aliases
 
Hi all,
I'm trying to make it possible to see my logfiles on a browser.
For instance, I want to browse to http://www.mysite.com/logfiles and see a listing of all my logfiles.
Because the logfiles reside outside of the web content directory, I'm trying to set up an Alias (sorry if my terminology isn't correct, but it's a newbie forum anyway). Here's how I'm doing it:

Code:

Alias /logfiles /path/to/my/logfiles
<Directory /path/to/my/logfiles>
  Order allow,deny
  Allow from all
</Directory>

Then I restart apache /etc/init.d/httpd restart

When I browse to http://www/mysite.com/logfiles I get a 404.

I've been online all morning looking for a solution and all I find is what I've already done.

BTW, this is a RHEL 5 on a LAMP stack.

Any ideas would be appreciated.

TB0ne 07-22-2011 01:11 PM

Quote:

Originally Posted by cleibesouza (Post 4422565)
Hi all,
I'm trying to make it possible to see my logfiles on a browser. For instance, I want to browse to http://www.mysite.com/logfiles and see a listing of all my logfiles. Because the logfiles reside outside of the web content directory, I'm trying to set up an Alias (sorry if my terminology isn't correct, but it's a newbie forum anyway). Here's how I'm doing it:
Code:

Alias /logfiles /path/to/my/logfiles
<Directory /path/to/my/logfiles>
  Order allow,deny
  Allow from all
</Directory>

Then I restart apache /etc/init.d/httpd restart When I browse to http://www/mysite.com/logfiles I get a 404. I've been online all morning looking for a solution and all I find is what I've already done. BTW, this is a RHEL 5 on a LAMP stack.

Check your apache configuration, usually in /etc/apache2. In your .conf file, add the "Options FollowSymLinks" directive. Should be in the default .conf file in the DocumentRoot section. There are other options, but FollowSymLinks lets Apache traverse an 'alias' like a symbolic link.

On another note...that's a VERY insecure thing to do. Any potential attacker can just browse your logs, and from those, get a picture of your internal network, user ID's, etc.

cleibesouza 07-22-2011 01:23 PM

hmm.. interesting.
I actually don't HAVE to see the log files in a browser, but I'd like to see them easier than using VI. What I need to look at are the access files once in a while. Do you have a recommendation of a better way to look at the log files?

Thanks.

TB0ne 07-22-2011 01:28 PM

Quote:

Originally Posted by cleibesouza (Post 4422590)
hmm.. interesting.
I actually don't HAVE to see the log files in a browser, but I'd like to see them easier than using VI. What I need to look at are the access files once in a while. Do you have a recommendation of a better way to look at the log files?

Thanks.

Two ways come to mind. I'd install and configure logwatch, and have it email you on a regular basis, or just log in via secure shell (SSH) and look at them manually. If you've got one server, that's the way to go, in my opinion, since it's more secure.

If you've got multiple servers, consider installing something like Nagios, that will watch log files for patters, and give you a web-page with lots of other stats too. You can secure the login on that page, and kill multiple birds with one stone.

cleibesouza 07-22-2011 01:47 PM

Thank you for the suggestions. I'm already seeing the log files using SSH. I was just looking for a better way to read them since vi is a pain. Logwatch is an option too and I'll check Nagios.

Your help is greatly appreciated.

eSelix 07-22-2011 03:38 PM

You can choose other editor than "vi", for example I am using viewer from "Midnight Commander".

jdix123 07-23-2011 11:31 AM

Check out this howto.

http://linuxcommand.org/writing_shell_scripts.php

He goes over creating a script which puts information about your machine into html formatting. With a few tweaks, you can put your log file information into the script instead, and view the logs in a browser without actually publishing the information to the web.

I'm not sure if this completely solves your security issue, but you can easily just delete the file once you viewed the necessary info. And its easier than scrolling through vi :)


All times are GMT -5. The time now is 07:35 AM.