Originally posted by LivinFree If you just want to clear out that one periodically, it may just be easier to whip up a little script that cp's it to another file (in case you want to review it later), compresses the archive, and truncates that file.
Here is a little Perl script that I cooked up for automagically rotating logs of an application that sends the data to STDOUT and redirected to file.
Seems that in the above situation that you can't just cp the file as the inode pointer will still point at the new filename and keep on adding data (I simulated this on my FreeBSD system for a thread on another forum).
Usage:
Hmmm. After looking at my code I realize that I could just keep on incrementing $lineCounter and just use modular arithmatic to set the point to rotate the log. That'll teach me.
Hey Guys,
i am new into shell programming and i have to do one script which have to record all the commands entered by a specific user.
Example of that, i have a system running on unix, several users are using this system, i have to create like a databse which will record every user entered that... (5 Replies)
Hy, I have a question
I have a directory in a unix server,
Some of my files have a diffrent access time,
from the time i accessed them last,
I think some one has copied it,it's not an important file,but none the less,it is my file,It mistakenly had a 777 permission( yes ,I know it is a noob's... (1 Reply)
Hi,
We are using rsync for syncing remote directories. It is working great along with detailed logs. As the script cron'd and most of the times there're no files to sync we are getting lot of unnecessary log entries and we need to filter them to show only the log entries for the files... (5 Replies)
Hi,
Last day, In one of our unix boxes there was an issue wherein few of the directory structures were missing / got deleted.
Is there any way by which we can find how it happened, I mean by going through syslog / which user had run what command?
Thanks for your help (3 Replies)
Hi,
I am trying to write a script which would go search and get the info from the logs based on yesterday timestamp and write yesterday logs in new file. The log file format is as follows:
""""""""""""""""""""""""""... (3 Replies)
Hi ,
I am running an application on my windows and it logs are generated at /var/logs and for this i have to go this location and then do tail -f , Is there any command you can advise me so that when I execute this command at this location that logs get displayed fully and as the application... (3 Replies)
hello,
i just want to know logs files for these actions listed below :
- User Account Creation
- User Account Deletion
- Failed and or Successful User Password Changes
- Failed Login Activities for all User Users
- System Reboot or and shutdown
help appreciated... (1 Reply)
My problem: Both access and error logs do not rotate any more and get really large.
They are located here: /srv/www/+vHost name here+/logs/
Configuration seems to be here:
/etc/logrotate.conf => looks OK, including "size 10M" to avoid large files
(/etc/logrotate.d => is empty)
manually... (4 Replies)
Appreciate help for the below issue.
Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt..............
1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies
LEARN ABOUT DEBIAN
log::handler::output::screen
Log::Handler::Output::Screen(3pm) User Contributed Perl Documentation Log::Handler::Output::Screen(3pm)NAME
Log::Handler::Output::Screen - Log messages to the screen.
SYNOPSIS
use Log::Handler::Output::Screen;
my $screen = Log::Handler::Output::Screen->new(
log_to => "STDERR",
dump => 1,
);
$screen->log($message);
DESCRIPTION
This output module makes it possible to log messages to your screen.
METHODS
new()
Call "new()" to create a new Log::Handler::Output::Screen object.
The following options are possible:
log_to
Where do you want to log? Possible is: STDOUT, STDERR and WARN.
WARN means to call "warn()".
The default is STDOUT.
dump
Set this option to 1 if you want that the message will be dumped with "Data::Dumper" to the screen.
log()
Call "log()" if you want to log a message to the screen.
Example:
$screen->log("this message goes to the screen");
validate()
Validate a configuration.
reload()
Reload with a new configuration.
errstr()
This function returns the last error message.
PREREQUISITES
Data::Dumper
Params::Validate
EXPORTS
No exports.
REPORT BUGS
Please report all bugs to <jschulz.cpan(at)bloonix.de>.
If you send me a mail then add Log::Handler into the subject.
AUTHOR
Jonny Schulz <jschulz.cpan(at)bloonix.de>.
COPYRIGHT
Copyright (C) 2007-2009 by Jonny Schulz. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-11-21 Log::Handler::Output::Screen(3pm)