Ok I'm processing a FlexLM license manager log file so I can show our management usage trends for our insanely expensive CAD software licenses. I want to calculate how much time, on average, a person is using a particular software license. The log format, briefly, is:

16:32:45 08/24/00 ms7 OUT MasterModeller user1@host1 16:32:48 08/24/00 ms7 OUT Drafting user2@host2 16:48:00 08/24/00 ms7 IN MasterModeller user1@host1
etc...

I was going to make a hash with keys of ProductName and user@host, and store a string consisting of the date and time for each OUT record, and then do some time-delta calculations when I saw the corresponding IN record by going back to the hash and retrieve the OUT time I stored. This worked fine until I realized that any given user on a host can check out the SAME product more than once ... i.e., they can have two Drafting licenses checked out simultaneously. My current hash would break, overwriting the first OUT time/date string with the second one.

I thought about just concatenating time+date+product+user@host into one string and pushing it on an array, and then scanning that array when I find an IN record and look for that same product+user@host. However, seems like thats going to involve a lot of serial scanning, pattern matching, and string decomposition.

Does anyone have a better suggestion? I can provide more details if required.


In reply to Data structure for log file processing by husker

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.