Forum Moderators: coopster

Message Too Old, No Replies

I am trying to read access log file

Access log file

         

subikar

12:23 pm on May 31, 2007 (gmt 0)

10+ Year Member



My access log file is has more then 8 lakhs lines. I am trying to read the log file and populate the data in database.
But due to long file I am not able to read the file after certain time.
It is showing an error :


Fatal error: Allowed memory size of 83886080 bytes exhausted (tried to allocate 85053676 bytes) in /gt/fsrv8/home/mithilesh/domains/example.com/public_html/mylab/dp.php on line 7

Is there any class available so I can get help from there.

Thanks in advance
Subikar

[edited by: eelixduppy at 12:57 pm (utc) on May 31, 2007]
[edit reason] exemplified error [/edit]

Habtom

12:42 pm on May 31, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Though it is good if you find another way of doing it, this can help you still perform what you have been trying to do

ini_set("memory_limit","16M");

I still have difficulties understanding what lakhs is, more people will understand you if you say a thousand or 100 thousand or whatever lakhs is. :)

Habtom

jatar_k

1:24 pm on May 31, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



odd that this has come up before

[en.wikipedia.org...]

it's 100000

that's not really that many lines.

If you are reading it to a db are you going to remove that data from the file once it is inserted? Otherwise you will continue to have the same problem.

Are these archived logs or your active log?

I would chop them up and then run your script on the smaller pieces. Each time the file is run I would run it on archived log files, if that isn't possible then I would copy the file first then 0 the active log, though apache can rotate logs much more effectively.

You need to make it so you are dealing with smaller chunks, however you figure out how that can happen.

subikar

7:39 am on Jun 1, 2007 (gmt 0)

10+ Year Member



I am very sorry "Habtom" it is 8000 hundred data in my logfile.

Now I am able to get data only of 671 lines But I want all the lines of data from the access_log to my table. How can I do this?