Unless I've misunderstood, the problem you have is that your soft-link is underneath the web-root directory.

The logs need to be accessible to the user that your web-server runs under, but that doesn't mean that they need to live inside your web-environment.

Here's an example script that I run on an intranet to allow me to view some log files - note that I cannot browse to these file directly from my browser.

#!/usr/bin/perl use strict; use CGI qw(:standard); my @logs = qw(/var/log/httpd/error_log /var/log/httpd/access_log /var/ +log/mysqld.log); my $log = $logs[0]; $log = $logs[param('log')] if param('log') =~ /1|2/; print header(); print start_html(-title=>$log); print '<pre>'; open(LOG, $log)||warn "cannot open $log: $!\n"; print while(<LOG>); print '</pre>'; print end_html();

Note that I cannot just paste "/var/log/httpd/error_log" into my browser and expect it to return anything...

map{$a=1-$_/10;map{$d=$a;$e=$b=$_/20-2;map{($d,$e)=(2*$d*$e+$a,$e**2 -$d**2+$b);$c=$d**2+$e**2>4?$d=8:_}1..50;print$c}0..59;print$/}0..20
Tom Melly, pm@tomandlu.co.uk

In reply to Re: Perl CGI - Viewing logfiles - Security Issues by Melly
in thread Perl CGI - Viewing logfiles - Security Issues by stumbler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.