Is there a PHP logging and analysing utility ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roman Ziak

    #1

    Is there a PHP logging and analysing utility ?

    I switched to Windows server and logs generated by my ISP are pathetic
    comparing to those from Apache. I would like to do logging via PHP and
    use the same log for visits and for PHP tracing. That means there can
    be plenty of information and lot of file/database access. Now there is
    several problems to address:

    1. For performance reasons, the log messages should be collected in
    array and then flushed into the file with single I/O access rather than
    I/O access with appending every single record.

    2. Is there some way in PHP to synchronise file access from another
    concurrent request ?

    3. Because of #1, the time-stamps of record from concurrent requests
    may not be sorted. This should be probably addressed during processing.

    4. Processing and analysing of the captured logs, recognizing visitor
    sessions, unique visitors, etc.

    Points 1-3 could be disregarded if database was used for logging. But I
    am afraid that database access will be always slower than direct file
    access.

    Before I dive into coding, I would like explore if there is something
    already available and I will appreciate references to scripts with good
    performance and analysing utility.

    Thanks
    Roman

  • Sjoerd

    #2
    Re: Is there a PHP logging and analysing utility ?


    Roman Ziak wrote:[color=blue]
    > 1. For performance reasons, the log messages should be collected in
    > array and then flushed into the file[/color]

    This is very hard. After a request has been done, the PHP script is
    done and its variables are no longer there. You would have to use
    shared memory or something like that. A file is much easier.
    [color=blue]
    > 2. Is there some way in PHP to synchronise file access from another
    > concurrent request ?[/color]

    flock()

    You probably want to write a Apache-like rule, so you can use standard
    tools to process it. For performance, first put the rule in a string,
    than lock the file, write the string, unlock the file. That should work
    fast enough.

    Comment

    Working...