Re: Need help with parsing a multilined log file into objects

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Yes! - Any instance of that class is your target object.


"Paulers" <SuperGh0d@xxxxxxxxx> wrote in message
news:1168405015.003441.265060@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Yes I pasted this straight from the log file. all messages begin with a
timestamp. The timestamp is always in the same format
(\d{2}:\d{2}:\d{2})

Im sorry I dont understand what you mean by definition of the target
object. I basically have a class with properties set and getters that I
would like to populate for each object. Is that what you would like to
see?

thanks for your help! :)
Stephany Young wrote:
To recap:

Does the data in the log file look EXACTLY like that?

Is there actually a newline betewen 'Control Message (=' and 'Message
Type'?

Does the timestamp, ('03:34:06') mark the start of the message?

Does the timestamp, ('03:34:06') mark the start of EVERY message?

Is the timestamp ALWAYS in the SAME format?

Please post the definition of the target object.


"Paulers" <SuperGh0d@xxxxxxxxx> wrote in message
news:1168403061.767940.71980@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The type of messages I want to extract from the log look like this
(type 101's) but not all messages are in the same format. I would like
to extract the values and populate an opject with the same properties
and store them in a collection that I can iterate through. I just do
not know how to get the values for each of these type 101 messages into
their own objects.

03:34:06 server12 Trace: [ 384]abox1->bbox1: Control Message (=
Message Type 101); Message Length 921 bytes
Get Call (= Subtype 9); DialogueID: (2007) 000007d7;
SendSeqNo: (1)00000001
Trunk Group ID: (1) 00000001
Trunk Number: 3
Service ID: (0) 00000000
Dialed Number: INTELLI_CARE
ANI: 1111111111
Called Number: 8000025225
DNIS: 8000025225

Stephany Young wrote:
What is the message delimiter and what is the field delimiter?

In addition, please post a sample of the logfile and the definition of
the
target object.


"Paulers" <SuperGh0d@xxxxxxxxx> wrote in message
news:1168395270.670571.150900@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

I have a log file that contains many multi-line messages. What is
the
best approach to take for extracting data out of each message and
populating object properties to be stored in an ArrayList? I have
tried
looping through the logfile using regex, if statements and flags to
find the start and end of each message but I do not see a good time
in
this process to create a new instance of my Message object. While
messing around with it I tried to create a new instance in different
places of the loops but when I try to populate it I can not access
the
object from within some if statements but not in others. I am
wondering
if there is a better approach perhaps one that is more abstract and
takes advantage of OOP. Has anyone done something like this before,
if
so I'd love to hear about your approach.

thanks





.



Relevant Pages

  • Re: Need help with parsing a multilined log file into objects
    ... The timestamp is always in the same format ... would like to populate for each object. ... Does the data in the log file look EXACTLY like that? ... Is the timestamp ALWAYS in the SAME format? ...
    (microsoft.public.dotnet.languages.vb)
  • Re: [RFC] BPF timestamping
    ... expand it to be able to use different format and resolution. ... This has too many timestamp types, ... involves clock ids of type clockid_t with names like CLOCK_REALTIME ...
    (freebsd-net)
  • Re: [opensuse] Experimenting with rsyslog message formats
    ... I'm trying to get rsyslog to output the messages in a format I would like. ... using the "RSYSLOG_SyslogProtocol23Format" template for one of the ... The TIMESTAMP value MUST ... Digging in the code I found that the date formats allowed by the rsyslog program are: rfc 3339, rfc 3164, pgsql and mysql. ...
    (SuSE)
  • Re: [RFC] BPF timestamping
    ... expand it to be able to use different format and resolution. ... This has too many timestamp types, yet not one timestamp type which ... The userland interface involves clock ids of type clockid_t ...
    (freebsd-net)
  • Re: [PhP - dB] About Formatting a Date Result
    ... In the MySQL database the field is set to date not timestamp as you ... foresight has stored a string date instead of a timestamp, ... and can format your date to that used, in the config files, for any user ...
    (php.general)