I'm trying to write a text log file processor but am having significant
performance issues.
* On average, there are about 100-200 files to process each file being about
1MB in size.
* Typically there are ~600k to 1m lines to process total. Every line in
each log file typically contains a date, a time, follwed by a textual message
* Unfortunately, not all log files have the same format/layout; e.g. some
may have only have month/day while others have year/moth/day; some may have
time with milliseconds (12:34:56.768) while other only have standard time
format (12:34:56)
* Log file contents from all files need to be sort merged to support either
viewing or post merge parsing/searches/whatever.
I have tried loading all of the file contents into memory, reformatting on
the fly to get dates, times, etc. in the same formart, and performing a sort
merge by comparing date and time stamps per line; which took forever (20-30
minutes on average.) I also tried using MS Log Parser which did the job
fairly but totally consumes CPU utilization (still took awhile as well.)
Surely there has to be a better approach without requiring a ton of memory
and thrashing disk I/O to read, reformat, and sort merge text log files. Any
suggestions and/or code examples?
Thanks,
Matt 8 1512
Mesterak,
I answer in the way of a question. Why do you think that people has
investigated databases?
First it where random databases and because of the maintenance problems with
those they came what is now relational databases.
Have a look for SQL Express
Your alternative are doing it yourself and create binary files, however be
aware of what I wrote about maintenance.
I hope this helps,
Cor
I don't require retention of the data thus, what maintenance is required?
None. Surely, there has to be some algorithm and/or best practice method out
there for doing this sort of thing without requiring a database.
Honestly, you have replied to three of my posts supplying equally vague
answers. I do appreciate your replies but am not finding the responses
beneficial in reaching solutions. You mention doing it myself and create
binary files. Ok, so how would this be done with some details and through
code examples?
"Cor Ligthert [MVP]" wrote: Mesterak,
I answer in the way of a question. Why do you think that people has investigated databases?
First it where random databases and because of the maintenance problems with those they came what is now relational databases.
Have a look for SQL Express
Your alternative are doing it yourself and create binary files, however be aware of what I wrote about maintenance.
I hope this helps,
Cor
Mesterak, Honestly, you have replied to three of my posts supplying equally vague answers. I do appreciate your replies but am not finding the responses beneficial in reaching solutions. You mention doing it myself and create binary files. Ok, so how would this be done with some details and through code examples?
I was busy searching for the linefeed character for you. However if this is
your idea, feel free.
But honetsly, don't ask something to a newsgroup, if you are sure you know
the answers better. Most people don't want to be in a newsgroup with text
answering direct to the given solution, which is so bad, that it can be
thought that it was there idea afterwards.
Succes
Cor
There was absolutely no need to take it personal. I was thanking you for
responding but was requesting more detail beyond you "hinting" as to a
solution path. You are the MVP with the answers, yes? If I knew the
answers, I wouldn't post questions. So again, I thank-you for responding and
only ask for more precision in your answers...only you know what you are
thinking, so you must please elaborate when responding or "break-it-down" for
us newbies...
Kindly,
Matt
"Cor Ligthert [MVP]" wrote: Mesterak,
Honestly, you have replied to three of my posts supplying equally vague answers. I do appreciate your replies but am not finding the responses beneficial in reaching solutions. You mention doing it myself and create binary files. Ok, so how would this be done with some details and through code examples? I was busy searching for the linefeed character for you. However if this is your idea, feel free.
But honetsly, don't ask something to a newsgroup, if you are sure you know the answers better. Most people don't want to be in a newsgroup with text answering direct to the given solution, which is so bad, that it can be thought that it was there idea afterwards.
Succes
Cor
Hi Matt,
"mesterak" wrote: There was absolutely no need to take it personal. I was thanking you for responding but was requesting more detail beyond you "hinting" as to a solution path. You are the MVP with the answers, yes? If I knew the answers, I wouldn't post questions. So again, I thank-you for responding and only ask for more precision in your answers...only you know what you are thinking, so you must please elaborate when responding or "break-it-down" for us newbies...
That's not what Cor meant. He means that there are better tools for doing
what you do without having to code your own engine. Try to reuse as much as
possible. Joining is a *natural* operation in databases. You write a simple
query, 3-4 lines long and get the results in a table, while you would code an
entire engine only to find the same results.
Anyway, using a database may not be an option for you. In that case you
could use the ODBC driver for text files and join (merge) the logs that way.
It supports several data/time formats and other. You will have to write a
short descriptor file for the log file formats, what this does is describe
the log file as a table to the ODBC driver. Search the net or respective
newsgroups for more info. Then you write a SQL query that gets the data how
you want it.
If that isn't an option, then is not much more to say. Write it by hand.
Kind regards,
--
Tom Tempelaere.
Thanks, I will check it out ;)
-Matt
"TT (Tom Tempelaere)" wrote: Hi Matt,
"mesterak" wrote:
There was absolutely no need to take it personal. I was thanking you for responding but was requesting more detail beyond you "hinting" as to a solution path. You are the MVP with the answers, yes? If I knew the answers, I wouldn't post questions. So again, I thank-you for responding and only ask for more precision in your answers...only you know what you are thinking, so you must please elaborate when responding or "break-it-down" for us newbies...
That's not what Cor meant. He means that there are better tools for doing what you do without having to code your own engine. Try to reuse as much as possible. Joining is a *natural* operation in databases. You write a simple query, 3-4 lines long and get the results in a table, while you would code an entire engine only to find the same results.
Anyway, using a database may not be an option for you. In that case you could use the ODBC driver for text files and join (merge) the logs that way. It supports several data/time formats and other. You will have to write a short descriptor file for the log file formats, what this does is describe the log file as a table to the ODBC driver. Search the net or respective newsgroups for more info. Then you write a SQL query that gets the data how you want it.
If that isn't an option, then is not much more to say. Write it by hand.
Kind regards, -- Tom Tempelaere.
Tom,
Beside this is about my other vague answers where Matt is talking about the
code from Jon (which Mat uses now) beside the buffer part completely based
on the same as my first answer to him.
Only Jon did write it in code for him.
Cor
Whatever...
"Cor Ligthert [MVP]" wrote: Tom,
Beside this is about my other vague answers where Matt is talking about the code from Jon (which Mat uses now) beside the buffer part completely based on the same as my first answer to him.
Only Jon did write it in code for him.
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tommo |
last post by:
Hello All,
whilst I know how to sort an array I am having problems with
my situation, what I would ideally like is something like a 'sort
keys' action with Perl hashes.
I am reading in data and...
|
by: Support |
last post by:
Hi,
I want to know if I have changed a few records in my database using update /
insert / delete methods, how can i later know which rows have been changed
or modified ?
I know the...
|
by: Learner |
last post by:
Hello,
Here is the code snippet I got strucked at.
I am unable to convert the below line of code to its equavalent vb.net
code. could some one please help me with this?
static public...
|
by: Martin Jørgensen |
last post by:
Hi,
I'm reading a number of double values from a file. It's a 2D-array:
1 2 3 4 5 6 7
-------------
1 3.2
2 0 2.1
3 9.3
4
|
by: mike |
last post by:
I help manage a large web site, one that has over
600 html pages... It's a reference site for ham radio
folks and as an example, one page indexes over
1.8 gb of on-line PDF documents.
The site...
|
by: truptidalia |
last post by:
Hi,
I am not that experienced in VB.NET. I am working on a application where i have to perform mail merge from the application. The application lets the userwrite letters, save them as rtf...
|
by: mqueene7 |
last post by:
below is my code for my merge sort but I can't get it to sort properly. I am trying generate random numbers based on input from the user and then sort those random numbers. Can you tell me what I...
|
by: Aaron Watters |
last post by:
....is to forget they are sorted???
While trying to optimize some NUCULAR libraries I discovered
that the best way to merge 2 sorted lists together
into a new sorted list is to just append
them...
|
by: Academia |
last post by:
ContextMenu has a Popup event but MainMenu does not.
I need Popup with MainMenu.
Do you know anyway to simulate it?
Thanks in advance
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |