Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 06-01-2011, 07:06 AM   #1
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, 10:30 AM   #2
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,398
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:
perldoc -f functionName
#  eg
perldoc -f write
--- rod.

Last edited by theNbomr; 06-01-2011 at 10:31 AM.
Old 06-01-2011, 10:51 PM   #3
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,670

Rep: Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487
See also, & this for realtime (equiv of tail -f)


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 12:19 AM
How to search logs between two timestamps in a log file. ram.venkat84 Linux - Newbie 2 11-19-2009 01: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 04:14 PM
dansguardian logs AD username in log file tanveer Linux - Server 2 04-28-2008 05:47 AM
Log iptables logs into other file Tux-Slack Slackware 2 11-18-2007 01:57 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:13 PM.

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