LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-01-2011, 08:06 AM   #1
indra4647
LQ Newbie
 
Registered: Jun 2011
Posts: 1

Rep: Reputation: Disabled
How to read individual logs from Linux server into another log file


I am new in perl, i have a question i.e 'How to read individual logs from linux server into another log file using perl script', I need to capture the individual logs from different paths and output the result of those log files and store to a file in another location.These Logs are generated in Linux Server..
 
Old 06-01-2011, 11:30 AM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
You use two conflicting terms: 'read' and 'capture', which I interpret with quite different meanings. Are you trying to simply open() and read() pre-existing files in a post-processing scenario? Or, are you trying to read data in some kind of real-time scenario (like what 'tail -f' does)?
In either case, for creating the output file(s), you need to simply open() for writing (either over-write or append as appropriate to you) the target file, write() your data, and then close() the file.
If your question is simply about the use of particular perl functions, then I think I have given you enough hints to get you started. For the details of any particular function call:
Code:
perldoc -f functionName
#
#  eg
#
perldoc -f write
--- rod.

Last edited by theNbomr; 06-01-2011 at 11:31 AM.
 
Old 06-01-2011, 11:51 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
See also http://perldoc.perl.org/, http://www.perlmonks.org/?node=Tutorials & this for realtime (equiv of tail -f) http://search.cpan.org/~mgrabnar/Fil...0.99.3/Tail.pm
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to separate individual logs? hadimotamedi Linux - Newbie 3 11-30-2010 01:19 AM
How to search logs between two timestamps in a log file. ram.venkat84 Linux - Newbie 2 11-19-2009 02:04 AM
In Apache server, How to change log file location and log format for access log fil? since1993 Linux - Server 1 08-19-2009 05:14 PM
dansguardian logs AD username in log file tanveer Linux - Server 2 04-28-2008 06:47 AM
Log iptables logs into other file Tux-Slack Slackware 2 11-18-2007 02:57 PM


All times are GMT -5. The time now is 12:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration