This is a request for insight on structuring data from a log file for later retrieval and stuffing into a mail message. I'm having trouble trying to set up the proper form of references to store this data. Here's the source log file format(line numbers are shown for clarification):
Line1: StatusField Server Name Field TimeStamp OtherStuff Line2 SUCCESS server01 Today's date Other details... Line3 WARNING server22 Today's date Other details...: Line4 SUCCESS server22 Today's date Still other details... Line5 WARNING server55 Today's date Other details.... Line6 WARNING server01 Today's date Other details.... .... And so on Each line can have the same server, timestamp and details are another line with the same server name--there are no complete duplicates of any line but lines could Have the same server name and timestamp but differ on the status field for certain detail items. I want to associate all lines from a particular server together so that I can mail copies of the lines in the log reports to particular addresses based on reading another file that contains a servername-->mailaddress association. I thought that I would read all the lines into an array, sort them by the server name so that all the records (lines) for a particular server are next to each other, loop through the records one by one, splitting each line into its individual columns, reading the other file of servername->mailaddresses to grab the mailaddress and after the servername changes, send the array of lines to a mailer. I can do the latter part fine if I only have one line per server. But since there can be multiple lines per server, I'm stumped how to set the data structure up. What I'm having a problem with is figuring out how to store the lines for a particular server in a structure that I can use as the basis of the mail message--I thought I wanted a hash of array references but can't figure out to do that without having a hard reference to an array for each server (that'd require hundreds of names and it appears to be a stupid approach to associate the structure with the values in the data. I think I want some form of anonymous array that can be referenced by a hash based on servername but can't seem to figure out how to get it set up correctly. It must be a mental block on the correct form of hash of arrays where the hash key is the servername and the value is an array of all arrays/records that contain the servername but... Thanks in advance.