473,508 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Scanning/rebuilding logs

Hello all,

I need to scan and rebuild logs dependent upon a certain time span, i.e. anything over 4 days older
than today. The beginning of each entry is formatted yyyy/mm/dd hr:min:sec. Now, I know I can have
a loop of reading in and creating a TimeSpan object from each entry, call it 'T1', and subtract today's date, call
it 'T0', from 'T1' and if the difference is equal to or greater than 4 days remove the entry; continue
looping until an entry is less than or equal to 4 days. But, for some reason that seems awfully
inefficient?

Seems to me I should be able to use RegEx somehow, but I'm just not sure how. Does anybody have
any experience with a 'efficient log scanner' or any ideas along these lines?

TIA,

Ray K.

Nov 16 '05 #1
1 870
Ray K.

You could use a regular expression. However, I am not sure which one
you would use.

Personally, if I had the choice, I would import the log into a SQL
server table (using Data Transformation Services) and then just query the
table created to determine how to import the log. Basically, you can set up
a pre-defined package to import your log file (which I am sure is in some
sort of delimited format) into SQL server (or some other data format). Once
it is there, querying the data you want should be a breeze.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"raykos" <an*******@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
Hello all,

I need to scan and rebuild logs dependent upon a certain time span, i.e. anything over 4 days older than today. The beginning of each entry is formatted yyyy/mm/dd hr:min:sec. Now, I know I can have a loop of reading in and creating a TimeSpan object from each entry, call it 'T1', and subtract today's date, call it 'T0', from 'T1' and if the difference is equal to or greater than 4 days remove the entry; continue looping until an entry is less than or equal to 4 days. But, for some reason that seems awfully inefficient?

Seems to me I should be able to use RegEx somehow, but I'm just not sure how. Does anybody have any experience with a 'efficient log scanner' or any ideas along these lines?
TIA,

Ray K.

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
995
by: andrei | last post by:
Hi Group, Environment: Windows 2000 Professional, VS.NET 2003 The solution has 30 projects (one main asp.net application and the rest are dlls) We have this annoying behaviour with our...
4
1361
by: tshad | last post by:
We have a few pages that accept uploads and want to scan the files before accepting them. Does Asp.net have a way of doing a virus scan? We are using Trendmicro to scan files and email but don't...
1
4524
by: Sam Durai | last post by:
Env: DB2 v9.1 Server / Win XP. DB is enabled for Archival Logging. Was playing around with rebuild tablespace feature. My database 'CARD' has tablespace named t1,t2,t3. Taken couple of...
23
3714
by: Rotsey | last post by:
Hi, I am writing an app that scans hard drives and logs info about every fine on the drive. The first iteration of my code used a class and a generic list to store the data and rhis took...
0
7224
marktang
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,...
0
7118
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7493
tracyyun
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...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.