EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Read log file writes?

Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.
#28249
Posted: 02/03/2014 16:36:12
by Tim Cash (Basic support level)
Joined: 02/03/2014
Posts: 2

I have some applications that write to log files while they are running but unfortunately the developer has locked those files while the application is running. I would like to read new lines added to the log files from C# and process them in my application. Would Callback Filter be a good solution for me? I want to be able to do something like in bash on linux "tail -f" on the log file. Not sure why this is so hard on windows.

-- Application writes lines to log file eg. "C:\temp\log.txt\"
-- Application prevents access to log.txt while running
-- My app wants to read only new lines written to log.txt and process them for analysis

v/r

-Tim
#28250
Posted: 02/04/2014 00:21:12
by Eugene Mayevski (EldoS Corp.)

Thank you for contacting us.

The task can be solved in two ways:

With CallbackFilter you can intercept writes as they are made - this will give you on-the-fly access to the data being written. You will know exactly what pieces of data are written. However to reach the data which has already been written within a session, you would need to open the file with help of our RawDisk product and read that existing data.

The second way is to use only RawDisk to open the file. RawDisk lets you bypass the security and sharing restrictions of the opened file.
After you get the handle to the file, you can read it or change file position in order to know when its size is changed. Unfortunately with this approach you won't be notified about file writes, so you will have to check file size periodically (using the above mentioned handle) and re-read the tail.


Sincerely yours
Eugene Mayevski
#28251
Posted: 02/04/2014 00:36:25
by Tim Cash (Basic support level)
Joined: 02/03/2014
Posts: 2

Thank you for the reply, could you point me to some c# code using CallbackFilter to intercept writes to a given file? eg C:\temp\log.txt ?

Also which license would I need as a single developer to include this capability in my product?

-Tim
#28252
Posted: 02/04/2014 00:54:40
by Eugene Mayevski (EldoS Corp.)

Quote
Tim Cash wrote:
could you point me to some c# code using CallbackFilter to intercept writes to a given file? eg C:\temp\log.txt ?


Please check Samples folder, there are many samples present there and they all intercept file operations. Filemon is the simplest to use in your case.

Quote
Tim Cash wrote:
Also which license would I need as a single developer to include this capability in my product?


That would be a Vendor license type and if you are a sole developer, we offer Private Business licenses with significant discounts.


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 4640 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!