Re: Filter out error log by IP address?

2010-01-28 Thread Sean Davis
On Thu, Jan 28, 2010 at 1:52 AM, Michael A. Capone
 wrote:
> Hello,
>
> I'm not sure this is a mod_perl question per se, but I'm hoping there's
> a mod_perl solution to our problem.
>
> We currently use a 3rd party security company to do a nessus-type
> security audit on our site for PCI compliance.  Their scans naturally
> generate a lot of noise in the error log, to the point that legitimate
> site errors are lost in the forest.  What I'm hoping to find / create is
> some kind of mechanism that can pre-empt writing to the error log and
> either 1) ideally, don't log if the client IP is xxx.xxx.xxx.xxx, or 2)
> always log the client IP address with each error, which will enable us
> to filter those out manually after the fact.  Either solution is acceptable.
>
> Apache provides a trivial solution for the access_log, in the form of:
>
>    SetEnvIf Remote_Addr xxx.xxx.xxx.* nolog
>
> ... however, that solution does not extend to the error log.  I'm hoping
> there's a mod_perl "hook" that can allow me to change apache's error
> logging behaviour to what I need it to be.
>
> Can someone point me in the right direction?

Hi, Michael.  Here is the LogHandler information:

http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlLogHandler

Sean


Re: Filter out error log by IP address?

2010-01-28 Thread Torsten Förtsch
On Thursday 28 January 2010 07:52:05 Michael A. Capone wrote:
> We currently use a 3rd party security company to do a nessus-type 
> security audit on our site for PCI compliance.  Their scans naturally 
> generate a lot of noise in the error log, to the point that legitimate 
> site errors are lost in the forest.  What I'm hoping to find / create is 
> some kind of mechanism that can pre-empt writing to the error log and 
> either 1) ideally, don't log if the client IP is xxx.xxx.xxx.xxx, or 2) 
> always log the client IP address with each error, which will enable us 
> to filter those out manually after the fact.  Either solution is
>  acceptable.
> 
> Apache provides a trivial solution for the access_log, in the form of:
> 
> SetEnvIf Remote_Addr xxx.xxx.xxx.* nolog
> 
> ... however, that solution does not extend to the error log.  I'm hoping 
> there's a mod_perl "hook" that can allow me to change apache's error 
> logging behaviour to what I need it to be.
> 
There is an error_log hook in apache:

error_log
  declared in ./include/http_log.h
  implemented in ./server/log.c   
  type is VOID
  void error_log(const char *file, int line, int level, apr_status_t status, 
const server_rec *s, const request_rec *r, apr_pool_t *pool, const char 
*errstr)

It is run at the end of log_error_core(). That means the error is already 
logged.

But perhaps you can set ErrorLog to /dev/null and implement your own logging 
using that hook.

That is where I would start.

Torsten


Re: Adding args to a Request through InputFilter

2010-01-28 Thread Ivory

You were right, after reviewing my code it works much better :)

Thanks again.

Ivory

Torsten Foertsch wrote:
> 
> If "pretty time-consuming" means a few microseconds then yes, it may be 
> modperl.
> 
> If more, it's your code.
> 
> To figure out how much mod_perl costs try fetching a small static file
> with 
> and without this lines:
> 
> ---
> 
> sub My::Handler::handler {0}
> 
> 
> PerlFixupHandler My::Handler
> ---
> 
> Use "ab -n 1 -c 1 http://..."; and compare the results.
> 
> Then add your fixup code and try again.
> 
> Torsten
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Adding-args-to-a-Request-through-InputFilter-tp27228223p27355930.html
Sent from the mod_perl - General mailing list archive at Nabble.com.



output filter

2010-01-28 Thread moli
Hello,

How to set the filter for some output headers?
I want to add some Expire: and Cache-Control: headers to make
downstream cacheserver to cache the pages.
Though they are dynamic pages, but I think they are safe to be cachable.

Thanks.


Re: output filter

2010-01-28 Thread Torsten Förtsch
On Thursday 28 January 2010 16:27:29 m...@normalperson.e4ward.com wrote:
> How to set the filter for some output headers?
> I want to add some Expire: and Cache-Control: headers to make
> downstream cacheserver to cache the pages.
> Though they are dynamic pages, but I think they are safe to be cachable.
> 
PerlOutputFilter "sub {  \
  use strict;\
  use Apache2::Filter ();\
  use Apache2::RequestRec ();\
  use Apache2::Const -compile=>qw/DECLINED/; \
  my ($f)=...@_;\
  @{$f->r->headers_out}{qw/Expire Cache-Control/}=   \
(q{...}, q{...});\
  $f->remove;\
  return Apache2::Const::DECLINED;   \
}"

Fill in the 2 ellipses.

Torsten



Re: output filter

2010-01-28 Thread Perrin Harkins
On Thu, Jan 28, 2010 at 10:27 AM,   wrote:
> I want to add some Expire: and Cache-Control: headers to make
> downstream cacheserver to cache the pages.
> Though they are dynamic pages, but I think they are safe to be cachable.

If you're generating them with mod_perl, you can just set the headers
in your response handler.  You only need an output filter if some of
them are coming from another source, like PHP.

- Perrin


Re: mod_perl-2.0.4 with Apache 2.2.9 and perl 5.10.0 intermittent crashing

2010-01-28 Thread Pas Argenio
Thanks John.  Currently, I'm building 32-bit for a Sparc platform and also
with man CPAN modules such as DBI and DBD.

I just rebuilt everything carefully, but still coring often before then
displaying a page:
   Apache 2.2.8   Perl 5.10.0   mod_perl 2.0.3

I also turned on perl internal malloc

Should I try 64-bit versions next, or fall back to perl 5.8.9?


On Wed, Jan 27, 2010 at 8:58 PM, John D Groenveld
wrote:

> In message <30a2344a1001271105t6c690071qb72eb53df2a68...@mail.gmail.com>,
> Pas A
> rgenio writes:
> >I'm building everything from source.  I've rebuilt perl a half-dozen times
> >both static & dynamic.  I'm working on building 5.10.1 but it seems so
>
> Does modperl's make test succeed?
>
> Under Solaris, you need to be very careful to match your Perl build
> to your Apache.
>
> These are my notes for 64-bit Apache stack for Solaris 10:
> http://www.cse.psu.edu/~groenvel/apache2.html
> >
> Some modperl and libapreq2 tests are failing, but not core dumping.
>
> John
> groenv...@acm.org
>
>


Re: mod_perl-2.0.4 with Apache 2.2.9 and perl 5.10.0 intermittent crashing

2010-01-28 Thread demerphq
2010/1/28 Pas Argenio :
> Thanks John.  Currently, I'm building 32-bit for a Sparc platform and also
> with man CPAN modules such as DBI and DBD.
>
> I just rebuilt everything carefully, but still coring often before then
> displaying a page:
>    Apache 2.2.8   Perl 5.10.0   mod_perl 2.0.3
>
> I also turned on perl internal malloc
>
> Should I try 64-bit versions next, or fall back to perl 5.8.9?

I recommend you try 5.8.9

Yves





-- 
perl -Mre=debug -e "/just|another|perl|hacker/"


Re: mod_perl-2.0.4 with Apache 2.2.9 and perl 5.10.0 intermittent crashing

2010-01-28 Thread Pas Argenio
I resolved it, finally.  Stupidly, we had created a symbolic link:
libmysqlclient.so.15 -> libmysqlclient.so.16.0.0

(I guess our source build of mysql-5.1.32 only provides
libmysqlclient.so.16.0.0 but DBD-mysql-4.008 needs libmysqlclient.so.15)
The fix was to get the real libmysqlclient.so.15 library from the
mysql.5.0.67 Sun package.  We should have known software is rarely FORWARD
compatible!
Now to fix it the right way, maybe the latest DBD-mysql uses the .16
library.

Anyway perl 5.10.0 does work (so far) on Solaris 10.


On Thu, Jan 28, 2010 at 11:44 AM, demerphq  wrote:

> 2010/1/28 Pas Argenio :
> > Thanks John.  Currently, I'm building 32-bit for a Sparc platform and
> also
> > with man CPAN modules such as DBI and DBD.
> >
> > I just rebuilt everything carefully, but still coring often before then
> > displaying a page:
> >Apache 2.2.8   Perl 5.10.0   mod_perl 2.0.3
> >
> > I also turned on perl internal malloc
> >
> > Should I try 64-bit versions next, or fall back to perl 5.8.9?
>
> I recommend you try 5.8.9
>
> Yves
>
>
>
>
>
> --
> perl -Mre=debug -e "/just|another|perl|hacker/"
>


Re: mod_perl-2.0.4 with Apache 2.2.9 and perl 5.10.0 intermittent crashing

2010-01-28 Thread Mark Copper
On Thu, Jan 28, 2010 at 04:30:04PM -0500, Pas Argenio wrote:
>I resolved it, finally.  Stupidly, we had created a symbolic link:
>libmysqlclient.so.15 -> libmysqlclient.so.16.0.0
>(I guess our source build of mysql-5.1.32 only provides
>libmysqlclient.so.16.0.0 but DBD-mysql-4.008 needs
>libmysqlclient.so.15)
>The fix was to get the real libmysqlclient.so.15 library from the
>mysql.5.0.67 Sun package.  We should have known software is rarely
>FORWARD compatible!
>Now to fix it the right way, maybe the latest DBD-mysql uses the .16
>library.
>Anyway perl 5.10.0 does work (so far) on Solaris 10.
> 
>On Thu, Jan 28, 2010 at 11:44 AM, demerphq <[1]demer...@gmail.com>
>wrote:
> 
>  2010/1/28 Pas Argenio <[2]pas.arge...@gmail.com>:
> 
>> Thanks John.  Currently, I'm building 32-bit for a Sparc platform and
>also
>> with man CPAN modules such as DBI and DBD.
>>
>> I just rebuilt everything carefully, but still coring often before
>then
>> displaying a page:
>>Apache 2.2.8   Perl 5.10.0   mod_perl 2.0.3
>>
>> I also turned on perl internal malloc
>>
>> Should I try 64-bit versions next, or fall back to perl 5.8.9?
> 
>  I recommend you try 5.8.9
>  Yves
>  --
>  perl -Mre=debug -e "/just|another|perl|hacker/"
> 
> References
> 
>1. mailto:demer...@gmail.com
>2. mailto:pas.arge...@gmail.com
Looks like Bug #37027 for DBD-mysql: mysql_auto_reconnect

I struggled with this one a while back myself.

Mark


Re: output filter

2010-01-28 Thread moli
Thanks all.
Yes the whole pages are generated from mod_perl not PHP.

BTW, though we are still using modperl for developing some applications.
But it seems other instead technologies are becoming more and more
popular, like PHP,Django,Rails etc.
Is modperl  outdated in today?

Regards.