title: Get a result of a log file parsing speed every 10 seconds in python
body: <p>I have a python code to parse a 1 TB log file, but the problem is my result is shown after the parsing process is finished. So for that I need to wait for 12 hours, and after 12 hours only then the result is shown. I want to know how can I parse a log file and know the result of the parsing speed every 10 seconds. 
  This is my code:</p>
  
  <pre><code>import re
  import timeit
  log_file = '/Users/kiya/Desktop/mysql/ipscan/ip.txt'
  output_file ='/Users/kiya/Desktop/mysql/ipscan/k2u.csv'
  name_to_check = 'MBX_AUTHENTICATION_FAILED'
  class Log_minning:
      def __init__(self):
          self.counter = 0
      def get_userdata(self):
          user_att = []
          list_usr = []
          counterr = 0
          with open(log_file, encoding='utf-8') as infile:
              for line in infile:
                  if name_to_check in line:
                      username = re.search(r'(?&lt;=userName=)(.*)(?=,)', line)
                      username = username.group()
                      date = re.search(r"([12]\d{3}(0[1-9]|1[0-2])+"
                                       "(0[1-9]|[12]\d|3[01]))", line)
                      date = date.group()
                      time = re.search(r"(\d{9}\+\d{4})", line)
                      time = time.group()
                      ip = re.search(
                          r'(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.)'
                          '{3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])',
                          line
                      )
                      ip = ip.group()
                      user_att.append(username)
                      user_att.append(date)
                      user_att.append(time)
                      user_att.append(ip)
                      list_usr.append(user_att)
                      counterr = counterr + 1
          self.counter = counterr
          return list_usr
  if __name__ == "__main__":
      lm = Log_minning()
      the_time = timeit.Timer(lm.get_userdata).repeat(1, 1000)
      sing_time = min(the_time)/1000
      speed = 600 / sing_time * lm.counter
      # for line in lm.get_userdata():
      #     print(line)
      print(
              "Processing " + str(lm.counter) + " in " + str(the_time) +
              "\nThe speed aproximately " + str(speed) + " data in 10 sec"
          )
  </code></pre>
  
  <p>This is the fully scanned seconds</p>
  
  <pre><code>Processing 117 in [6.646515152002394]
  </code></pre>