Hi Ravenhaus,
You wrote that you already have your log read and displayed.
How is the log stored into memory ? using a memo or perhaps a stringlist, or did you create your own custom (record) list with entries ?
If you wish to parse the log file, then what would you like to do with the parsed information ?
Are there much entries that need parsing, and how do you wish to store the parsed information. For example if you already have the log displayed in a memo, then would you like to have something like a find/find next entry or do you prefer to extract those lines and store them somewhere else ?
As you can see for yourself , more questions then answers :-)
Geepster is correct in that a line is easily parsed, especially when log entries are having a somewhat fixed format. In that case it is just matter of counting (and copying) a bunch of characters, recognizing those line you are interested in and extract the relevant information.
In case i would have to analyze such log and know there are many entries that i am interested in (and be able to reference that information), i would start with defining a structure which can hold all relevant information, so for example:
Type
TConnection = record
IP : Int64;
Port : Word;
end;
TSession = record
Session_Start : TDateTime;
Session_End : TDateTime;
Connection : TConnection;
// etc etc.
end;
var
Sessions : Array of TSession;
And fill in the array, based on what was parsed from the log. You could then use the array to search, or sort things, store it to disk again in your own format etc. In case more functionality is wanted then turn things into class(es).