The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Operating Systems
> Linux Help
|
Log files - please help!!!
Discuss Log files - please help!!! in the Linux Help forum on Dev Shed. Log files - please help!!! Linux Help forum discussing topics including usage, troubleshooting, modules, and distributions. Linux is an open source OS, based on UNIX.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

October 16th, 2001, 03:51 AM
|
 |
Oheim
|
|
Join Date: Jun 2001
Location: Austria
Posts: 69
Time spent in forums: < 1 sec
Reputation Power: 12
|
|
Log files - please help!!!
Hy guys!
I'm about to give up...
First up: I have not a lot knowledge about Linux. The company I work for just rented a web-server. I know how to get those Apache Log files to rotate every 24 hours.
But my boss wants monthly ones, which are named like browser_log_2001-10.log. Now I know that I sorta need to merge the daily ones into one monthly one and delte the old daily ones.
Now, I could have Apache make that, but in the Docs it says you shouldn't because of performance.
How would I do this? I searched for progs which would do this task for me, but the only one I could find doesn't work on our Server.
Can anybody point me to a prog like that, or tell me how to do this?
Bear in mind, that I am a total Linux newbie!
Thanks in advance!
Sheriff
__________________
There are two major products that come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence.
God is just hacker who rooted the world!
|

October 17th, 2001, 06:51 PM
|
|
Contributing User
|
|
Join Date: Mar 2001
Location: L.A.
Posts: 49
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
I too went throught the same thing with my boss, but I found a program that you should really check out it will take care of you log problems its called webalizer and you can get it from http://www.mrunix.net/webalizer/
__________________
Have a lot of fun...
|

October 18th, 2001, 07:24 AM
|
 |
Oheim
|
|
Join Date: Jun 2001
Location: Austria
Posts: 69
Time spent in forums: < 1 sec
Reputation Power: 12
|
|
|
Hy-
thanks for your reply, but my problem is the rotation of the logfiles, not the processing. To get our stats, we use something different. But thanks anyways!
best regards
Sheriff
|

October 18th, 2001, 07:43 AM
|
|
Contributing User
|
|
Join Date: Jan 2001
Posts: 5
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
You need a log processing program more than a log rotation one since they are already rotated. The biggest concern is performance and resources, including the merging and parsing whenever your boss needs to read it.
When you can't find such script for such abnormal task, why not writing your own script? It should be plain simple and doesn't take you 1 month of Perl/PHP knowledge.
Once you decide which language to use, and if you have a problem, post it to Perl/PHP forum.
Keep in mind, you don't need to merge them to one big file for parsing. You can even gunzip it on the fly if it's browser_log_2001-10_log.gz.
|

October 18th, 2001, 08:58 AM
|
 |
Oheim
|
|
Join Date: Jun 2001
Location: Austria
Posts: 69
Time spent in forums: < 1 sec
Reputation Power: 12
|
|
|
Actually I was thinking of writing my own PHP script to do what I want it to do.
I have only 2 problems with that:
1) How do I get the Logfile to be read/writeable by PHP?
2) Can I run PHP as a bash script? Cos if I can't I have the problem, that apache will have to do it again...
Oh, at the moment my logfiles are
user/goup: root/root
permissions: -rw-r--r--
If I do it with PHP they need to be r/w for the apache server right?
best regards
Sheriff
|

October 18th, 2001, 05:27 PM
|
|
Roving Icicle
|
|
Join Date: Jul 2001
Location: Netizen
Posts: 56
Time spent in forums: < 1 sec
Reputation Power: 12
|
|
|
In order for any script to proccess the logs, or any file for that matter, its process must have r/w privs.
As for the script itself, I'd actually reccomend using a shell scripting language such as Bourne (Again) or Korn. The script will be a bit simpler (IMO) and run with less overheard. Its also much eaiser to cron a shell script than to do the equivelant to a PHP script.
And, no, as far as I know, you can't run PHP as a bash script.
__________________
Is it just me or is it cold in here?
|

October 18th, 2001, 10:55 PM
|
|
Contributing User
|
|
Join Date: Jan 2001
Posts: 5
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
>> 1) How do I get the Logfile to be read/writeable by PHP?
The user Apache runs as just need priviledge to READ, not WRITE. And permissions: -rw-r--r-- is world-readable and fine.
>> 2) Can I run PHP as a bash script?
If you can't use PHP to do it, always look for alternative. BTW, you can write a Perl or Shell script or whatever to do the backend stuff via cron and use PHP as the frontend for viewing log info via browser.
If you don't know where to start, go buy a Perl for dummies or PHP newbie book. The task you need to do is very basic.
|

October 21st, 2001, 08:02 AM
|
 |
Wacky hack
|
|
Join Date: Apr 2001
Location: London, England
Posts: 513
Time spent in forums: 1 h 38 m 37 sec
Reputation Power: 13
|
|
|
I would havethought Perl would be the obvious choice here, being more suited for admin scripting... in fact you'll probably find there are loads of Perl scripts hidden throughout your OS already. And if you like you can give the script a web frontend too. Look for O'Reilly - Learning Perl, or O'Reilly - Programming Perl (or both, even better!).
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|