469,271 Members | 1,008 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

Log query search, tricky with efficient non-overlaping interval

1
I'm building a log search function in c# for a certain management app and would like some help on the design how to solve
this, here is my solution (on paper) so far:

The log files are saved to disk, one file per date and one row "per logged event". Each row has a specific logged time
(within the file's date) with different keys and values.

The search filter query is built up via comboboxes and a datagridview. The datagridview is databinded
to a DataTable with columns such as "Date", "Account" etc. The query can contain several search rows with different parameters
specfied. The user should be able to choose date either by saying 'All logs' (taking all logfiles available) or requesting
logs from 'Last X weeks' or by specyfing do DateTime-values.

All this works ok, but the issue comes when to really search for this query. I would like to achieve a way of merging
the filter rows to be as few as possible so that no rows overlaps in date. Why I want this is because
when I loop thourgh the logfiles and each line in the current file, I only want to read the lines once to avoid reducing the
performance and operation time.

So an example;

Row 1: Date: a|----------------|d , "Orders=3", "Price=30", Type=High"
Row 2: Date: b|-----|c , "Orders=All", "Price=62", Type=Medium"
Row 3: Date: All logs , "Orders=4", "Price=20", Type=Medium"

This should be merged to this:

Row 1: Date: -*|----|a, "Orders=4", "Price=20", Type=Medium"
Row 2: Date: a|------|b, "Orders=All", "Price=30,62,20", Type=High,Medium"
Row 3: Date: b|------|c, "Orders=All", "Price=30,62,20", Type=High, Medium"
Row 4: Date: c|------|d, "Orders=3,4", "Price=30,20", Type=High, Medium"
Row 5: Date: d|------|+*, Orders=4", "Price=20", Type=Medium

The '-*' and '+*' indicates the lowest/highest avaiable date if we the 'All logs' specified. Also
note that the 'All'-value have precedence over other values. This gives an non-overlapping interval which
satifies the whole query efficiently.

So, any hints on how to implement such a thing? Or should I consider using some other design approach? Any little help is appreciated!

Sincerely yours, Kevin
Jul 20 '08 #1
0 948

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Bacci | last post: by
9 posts views Thread by netpurpose | last post: by
11 posts views Thread by Eugenio | last post: by
7 posts views Thread by Simon Bailey | last post: by
3 posts views Thread by dskillingstad | last post: by
19 posts views Thread by RAJASEKHAR KONDABALA | last post: by
28 posts views Thread by joshc | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.