Re: What is the preferred way to parse messages out of a log?



On Sun, 17 Sep 2006 16:54:41 -0500, <SuperGh0d@xxxxxxxxx> wrote:

Thanks for the replies. I need to extract the values of the message and
I was hoping to create objects from them and stuff the objects into an
arraylist so I can iterate through them. Eventually the idea is to
build a servlet that will format the messages in a easier to read
format, provide searching and message grouping by the dialogID. I have
played with perl and I feel the use of Java objects is easier for me to
understand than using perl's hashes. Obviously you feel perl is the way
to go,

Not me - I never can keep Perl operators straight.

can you provide me a basic example of how you would store the
data in a structure so I can retrieve them later?

http://servingxml.sourceforge.net/examples/index.html
has several worked out examples of flat file to XML document that
might inspire you. Once you have a DOM, you could use XPath as provided
in Java 1.5 (javax.xml.xpath package) to selectively extract values.
(a quick survey of xpath use)
http://searchwebservices.techtarget.com/tip/1,289483,sid26_gci1166338,00..html


William Brogden wrote:
On Sat, 16 Sep 2006 20:43:30 -0500, <paulers69@xxxxxxxxx> wrote:

> Hello,
>
> I have a large log file that contains information that I wish to pull
> out.. The log entry consists of multiple lines per message Can someone
> point me in the right direction to extracting this data? Below is an
> example of an entry that I would like to parse the values out of. Your
> help is greatly appreciated.
>
> 11:44:29 pg100B-pim1 Trace: [ 2516]VRU->PG: Service Control Message (=
> Message Type 47); Message Length 713 bytes
> New Call (= Subtype 5); DialogueID: (74521) 00012319;
> SendSeqNo: (1)00000001
> Trunk Group ID: (1) 00000001
> Trunk Number: 2
> Service ID: (1) 00000001
> Dialed Number: JP_TMZ_CARD_FDS
> ANI: 5125379013
> Called Number: 8889648542
> DNIS: 8889648542
> Call Variable 1:
> Call Variable 2: FDS
> Call Variable 3:
> Call Variable 4:
> Call Variable 5:
> Call Variable 6:
> Call Variable 7:
> Call Variable 8:
> Call Variable 9: 5125379013 ,00
> Call Variable 10:
> ECCVar:3: "dd849f24-270d-11db-469c-00e081022fd9
> 8889649541
> 3
> "
>

If you are comfortable with Java tools for XML you might look into
this "pipeline" oriented toolkit:
http://servingxml.sourceforge.net/

The site contains examples of working with various "flat" file formats
and interconverting to and from XML.

Bill

.



Relevant Pages

  • Re: What is the preferred way to parse messages out of a log?
    ... I need to extract the values of the message and ... format, provide searching and message grouping by the dialogID. ... Trunk Group ID: 00000001 ... If you are comfortable with Java tools for XML you might look into ...
    (comp.lang.java.help)
  • Re: xml/vb/java common date format
    ... >transfer date/time values between them in an XML attribute. ... >my first thougtht was to use RFC822 date/time format because I can produce ... >available for both java and vb ... For decoding I strongly recommend that you do it yourself using Mid$ ...
    (comp.lang.java.programmer)
  • Re: What is the preferred way to parse messages out of a log?
    ... format, provide searching and message grouping by the dialogID. ... the program that generated the log file probably has each of the ... Trunk Group ID: 00000001 ... If you are comfortable with Java tools for XML you might look into ...
    (comp.lang.java.help)
  • Re: application communication in xml without webservices?
    ... Java tools that work well with services designed to use cross-platform data ... elements that fall into the intersection of the .NET, Java and XML Schema ... >- webservices remove some of the complexity out of communicating ... >> that standardize how you'll use HTTP so that others who follow in your ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Sane Syntax
    ... vital role in the future of TeX but we need some more human friendly ... Generating well formed LaTeX2e documents from XML ... Another approach is to convert existing documents to XML format and go ... TEI, together with DocBook, are the two ...
    (comp.text.tex)