Hello,
How can I get session details - like remote ip address - in custom event handler or function hooks system? When some user deletes a file trough file manager, there are nothing in logs other than "POST /json-api/", and I'm writing a logger to catch removed files:
The specified log file shows this but I'm missing the remote ip address which removed this file :
How can I get session details - like remote ip address - in custom event handler or function hooks system? When some user deletes a file trough file manager, there are nothing in logs other than "POST /json-api/", and I'm writing a logger to catch removed files:
Code:
sub event {
print STDERR @_;
my ( $apiv, $type, $module, $event, $cfgref, $dataref ) = @_;
return 1 if ( $module ne 'fileman' );
my $logger = Cpanel::Logger->new({ alternate_logfile => "/usr/local/cpanel/logs/unlink_log" });
if ($module eq 'fileman') {
if ($event eq 'fileop') {
if ( $type eq 'post' ) {
if ($dataref) {
my $user = $Cpanel::user;
my $op = $cfgref->{'op'} ;
my $msg ;
if ($op eq 'unlink') {
foreach (@$dataref) {
if ( $_->{'result'} ) {
$msg = "File Manager - $user - $_->{'src'}" ;
$logger->info($msg);
}
}
}
}
}
}
return 1;
}
return 1;
}
Code:
==> /usr/local/cpanel/logs/unlink_log <==
[2012-11-21 17:02:26 -0200] info [cpanel] File Manager - bla - /home/bla/public_html/c
Last edited: