Log monitoring tool RRS feed

  • Question

  • We have an application with us which is generating logs for it. Along with the log entries, this application also saves HeartBeat entry after certain time interval. HeartBeat format is

    02/11/2011 06:00:29 --HeartBeat--
    06:56:40 ## Error  ABCD
    06:56:40 ## Info Files loaded 
    06:56:40 ## Info connection successful 
    02/11/2011 06:00:59 --HeartBeat--

    My .NET application needs to monitor all those applications with the graph Displaying- time vs HeratBeat status(ON/OFF).  This Graph will have only last 1 hour entries of HeartBeat. Everyday new log will get generated. So if logfile started at 9:00 am and now its 6.00 pm, then it shold show me HeartBeat status from 5-6 pm. This should be the dynamic graph.

    Is there any way to do this?

    I have written some code to retrive all Heart beat entries. Can you suggest a more efficient logic? Also don't have idea about the graph. I want to do this application in ASP.NET


    using (StreamReader streamReader = new StreamReader(fileStream))


    // Create an array for storing last 1 hours heart beat log entries

    ArrayList ListLines = new ArrayList();

    while (!streamReader.EndOfStream)  

     string tempVar = streamReader.ReadLine(); 

    if (tempVar.IndexOf("--HeartBeat--") > 0)


    // Add only those lines which are with in time-span of graph

     //if (Convert.ToDateTime(tempVar.Substring(0, 8)) >= DateTime.Now.AddHours(-1))

    DateTime currentTime = DateTime.Now;


    for (DateTime t = currentTime; t > currentTime.AddHours(-1); t = t.AddSeconds(-30))


    bool isFound = false;

     for (int i = ListLines.Count; i > 0; i--)


    string tempVal = ListLines[i - 1].ToString().Substring(0, 8);

     if (Convert.ToDateTime(tempVal) == t)


    isFound =true;



     if (!heartBeatEntries.Contains(t.ToLongTimeString()))



     if (isFound)

    heartBeatEntries.Add(t.ToLongTimeString(), 1);


    heartBeatEntries.Add(t.ToLongTimeString(), 0);









    • Edited by t_deepak Thursday, November 3, 2011 9:35 AM
    • Moved by Dummy yoyo Thursday, November 10, 2011 5:18 AM (From:Visual C# General)
    Wednesday, November 2, 2011 1:09 PM


All replies

  • Sure it's possible.  What specific problems are you having doing it?  Are you just expecting someone here to code the entire project for you?  Do you know how to parse the file for information?  Do you know how to draw the graph?  
    Wednesday, November 2, 2011 2:22 PM
  • Hi t_deepak,

    Welcome to the MSDN forum!

    There is an article providing a good example of logging monitor in ASP.NET application. Please take a look at the following link:

    Log Reporting Dashboard for ASP.NET MVC


    In the meantime, you can contact more experts on ASP.NET at: where you can get more responses to ASP.NET issues.

    Thank you for your understanding and have a nice day!

    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Edited by Dummy yoyo Friday, November 4, 2011 6:31 AM
    • Marked as answer by t_deepak Wednesday, December 5, 2012 9:39 AM
    Friday, November 4, 2011 6:29 AM