|
|
|
|
Posted by onlineviewer on May 3, 2006, 11:29 pm
Please log in for more thread options
Hello All,
I'm trying to use this Log::Rotate module but i am getting an error
messages when i try
to run this script. I dont know enough to know where the problem may
be.
############################
use Logfile::Rotate;
my $log = new Logfile::Rotate( File =>
'/usr/local/apache/logs/error_log',
Count => 7,
Gzip => 'lib',
Post => sub{
open(IN,
"/usr/local/apache/logs/httpd.pid");
kill("HUP", chomp(<IN>)); }
Dir => '/var/log/old',
Flock => 'yes',
Persist => 'yes',
);
# process log file
$log->rotate();
############################
ERROR MESSAGE:
Can't modify <HANDLE> in chomp at log_rotate_script02.pl line 9, near
"<IN>)"
syntax error at log_rotate_script02.pl line 10, near "Dir"
Execution of log_rotate_script02.pl aborted due to compilation errors.
Any advice ?
Thanks,
|
|
Posted by Sisyphus on May 4, 2006, 1:24 am
Please log in for more thread options
> Hello All,
>
> I'm trying to use this Log::Rotate module but i am getting an error
> messages when i try
> to run this script. I dont know enough to know where the problem may
> be.
>
> ############################
>
> use Logfile::Rotate;
> my $log = new Logfile::Rotate( File =>
> '/usr/local/apache/logs/error_log',
> Count => 7,
> Gzip => 'lib',
> Post => sub{
> open(IN,
> "/usr/local/apache/logs/httpd.pid");
> kill("HUP", chomp(<IN>)); }
> Dir => '/var/log/old',
> Flock => 'yes',
> Persist => 'yes',
> );
>
> # process log file
>
> $log->rotate();
>
> ############################
>
Make that:
Post => sub{
open(IN,
"/usr/local/apache/logs/httpd.pid");
kill("HUP", chomp(<IN>)); },
(ie add a comma at the end) and I think it will be fine. The way you've
written it there's no separation between the hash entry for 'Post' and the
hash entry for 'Dir'.
Cheers,
Rob
|
|
Posted by onlineviewer on May 4, 2006, 10:49 am
Please log in for more thread options
Hello Again,
I tried that out and i am gettting this message still:
Can't modify <HANDLE> in chomp at log_rotate_module02.pl line 9, near
"<IN>)"
Execution of log_rotate_module02.pl aborted due to compilation errors.
|
|
Posted by onlineviewer on May 4, 2006, 11:28 am
Please log in for more thread options
I've also tried this script, but no luck..
#####################################
use Logfile::Rotate;
my $log = new Logfile::Rotate( File =>
'/usr/local/apache/logs/error_log',
Count => 7,
Gzip => '/usr//bin/gzip',
Signal => sub {
my $pid = `cat
/usr/local/apache/logs/httpd.pid`;
my @args = ('kill', '-s',
'HUP', $pid );
system(@args);
},
Dir => '/var/log/old'
);
$log->rotate();
#####################################
Error Message:
Signal is a deprecated argument, see Pre/Post at log_rotate_module03.pl
line 12
/usr/bin/kill[8]: 431^J: Arguments must be %job or process ids.
|
|
Posted by Sisyphus on May 4, 2006, 9:55 pm
Please log in for more thread options
> Hello Again,
>
> I tried that out and i am gettting this message still:
>
> Can't modify <HANDLE> in chomp at log_rotate_module02.pl line 9, near
> "<IN>)"
> Execution of log_rotate_module02.pl aborted due to compilation errors.
>
Oh yes - you can't do a 'chomp(<IN>)'. (Sorry, missed that.)
One way is to code it as:
Post => sub{
open(IN, "/usr/local/apache/logs/httpd.pid") or die $!; # check that open
succeeded
my $t = <IN>;
chomp($t);
kill("HUP", $t);
},
I don't use this module, btw, and know nothing about it - I'm just trying to
fix the errors based on the messages being generated. I don't know whether
that's going to make the script do whatever it is you're hoping it will do
:-)
Cheers,
Rob
|
| Similar Threads | Posted | | [RFC] File::Rotate - read from rotating logfiles | November 29, 2004, 7:29 am |
| new module Logfile::Access | October 23, 2004, 8:30 pm |
| Simulation logfile parser problem | March 1, 2005, 1:29 am |
| help with module naming: filehandle-tie for size-limited/rotating logfile | March 18, 2007, 5:44 am |
| [RFC] File::Rotate::Syslog - read from rotating syslog files | November 29, 2004, 8:36 am |
| Error: RCPT TO: error (550 relay not permitted) | February 11, 2006, 1:39 pm |
| GD.c: 533: error: syntax error before "void" | March 24, 2006, 10:15 am |
| Error while using LWP | December 1, 2005, 8:06 am |
| Have I an error in my POD? | December 21, 2005, 6:35 pm |
| Deparse error | July 7, 2004, 2:52 am |
|
|
|
|