#1
  1. Oheim
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Austria
    Posts
    69
    Rep Power
    13

    Unhappy 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!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    L.A.
    Posts
    49
    Rep Power
    14
    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...
  4. #3
  5. Oheim
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Austria
    Posts
    69
    Rep Power
    13
    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
    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!
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Posts
    4
    Rep 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.
  8. #5
  9. Oheim
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Austria
    Posts
    69
    Rep Power
    13
    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
    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!
  10. #6
  11. No Profile Picture
    Roving Icicle
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    Netizen
    Posts
    56
    Rep Power
    13
    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?
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Posts
    4
    Rep 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.
  14. #8
  15. Wacky hack
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2001
    Location
    London, England
    Posts
    513
    Rep Power
    14
    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!).

IMN logo majestic logo threadwatch logo seochat tools logo