One script I have always wanted to write is one that will search through a log file created by a proxy server or firewall and give a basic report of how long each user spent browsing the web. After messing with Perl for a year or so, I could now probably figure out how to write the code but I can't quite figure out the logic. My problem comes from the information most logs contain. They simply have an entry with the URL visisted by a user as well as other data including the date and time it was visited, but not the length of time spent at that URL. Then, when the user changes addresses that new URL is logged and and so on. The problem I am struggling with is how to come up with a decent way of taking that information and adding it together to come up with a user's total time spent on the web. Keep in mind that while a user is looking at one site, the log may get several entries from other users going to other URL's. Also, the server doen't log anything when the user simply closes his browser? In other words, its not just as simple as adding those times together. What if the user quit browsing at 9:00 a.m. and starting again at 2:00 p.m.?

Maybe someone has seen such a script that might lead me in the right direction?

In reply to Perl Programming Logic by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.