1 Reply Latest reply on Jul 5, 2009 11:03 PM by anirudhs

    Read and convert large logfiles.

    zarkam1

      Hi!

      Im trying to do a little air app, that loads log files from our system, divides the logs according to some column name, and then I use the timestamps to

      generate charts, to ease discovering timing problems etc.

      First I used

      fileStream.open(myFile, FileMode.READ);

      arr=fileStream.readUTFBytes(fileStream.bytesAvailable).split("\r");

      which worked nicely.  (20 MB logfiles worked)

      But when I try to load really large logs (85 MB)

      I tried to use

       

      fileStream.openAsync(myFile, FileMode.READ)

      and then

       

      private function onFileProgress(p_evt:ProgressEvent):void
        {
          if (_fileStream.bytesAvailable > 8000)
        {
          giantstring+=_fileStream.readUTFBytes(_fileStream.bytesAvailable);

        }
          }

       

      and then in

      private function onFileComplete .......

      I i tried something similiar as above first:

      arr= giantstring.).split("\r");

      but it didnt work.

      Now Im trying to

      read each line in the giantstring and push it into an array(tried 10 MB) but gets error when trying the big one.

       

      (string length = 90835506 )

       

       

      Anyone have some suggestions ? Can it work, loading the filestream into an array, or should i divide the logfile into lesser ones and load them one after another?

       

      (Logfile looks like this:

      2009-06-12 15:52:32.007 | u30385_11964.090612.155231940.006 | se.rsv.fh.mt.to.FhMottagningTO.rensaKlaraMeddelanden | 0 | [] | 1335                                                                     
      2009-06-12 15:52:32.007 | u30385_11964.090612.155231940.005 | se.rsv.at.prt.ph.AtPhProcessHanterareTO.initieraInkorgsOptimering | 0 | [] | 2618                                                      

      )

       

      (I raised the heap of Flex Builder, didnt help)

      Best Regards

      Lukas