title: C#: Log parsing date/time with regex, when there's an anomaly of >1 second, I want to save that whole line to a new file
body: <p>I've written up a program in C# that helps me parse large logs (~2 GBs or more). So far, I've made it output only the time:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Globalization;
  using System.IO;
  using System.Linq;
  using System.Text;
  using System.Text.RegularExpressions;
  
  namespace LogParser
  {
  class Program
  {
      static void Main(string[] args)
      {
          int counter = 0;
          string line;
          System.IO.StreamReader file = new System.IO.StreamReader(@"C:\\Users\\Jan\\Desktop\\api_fiter_sql.log");
          Console.WriteLine("Profesionalno branje logov se začenja: ");
          System.Threading.Thread.Sleep(2500);
          while ((line = file.ReadLine()) != null)
          {
              counter++;
              var regex = new Regex(@"\d{2}\:\d{2}:\d{2}.\d{4}");
              foreach (Match m in regex.Matches(line))
              {
                  DateTime dt;
                  if (DateTime.TryParseExact(m.Value, "HH:mm:ss.ffff", null, DateTimeStyles.None, out dt))
                  {
                      Console.WriteLine(dt.ToString("HH:mm:ss.ffff"));
                  }
              }
          }
          Console.WriteLine("Branje logov je končano. Prebrali smo: " + counter + " vrstic");
          Console.ReadKey();
      }
  }
  }
  </code></pre>
  
  <p>Now, one line of the logs looks like this:</p>
  
  <pre><code>&lt;SQL &gt; &lt;TID: 0000000449&gt; &lt;RPC ID: 0000000000&gt; &lt;Queue: Admin     &gt; &lt;Client-RPC: 390600   &gt; &lt;USER:                                              &gt; &lt;Overlay-Group: 0         &gt; /* Mon Feb 26 2018 13:52:08.4510 */ OK
  </code></pre>
  
  <p>What I would like to do is; when there's a timeout (more than one second in between two times), I would like the program to export that data (of both lines; for example 10:10:10.0000 -> 10:10:15.0000) to let's say a .csv or a .txt (doesn't matter).</p>
  
  <p>How would I go about doing that? I've thought about using if statements, but I've got no idea where to start.</p>