title: trim big log file
body: <p>i perform performance tests for a few java applications. Applications produce very big log files( it can be 7-10 GB) during the test . I need to trim these log files between specific dates and time. currently, i use python script, which parses log timestamps in datetime python object and print only matched strings. But this solution is very slow. 5 GB log is parsed about 25 minutes
  Obviously entries in log file is sequentially and i don't need to read all file line by line. 
  I thought about reading file from the start and from the end, until condition is matched and print files between matched number of lines. But i don't know how can i read file from the backwards, without downloading it to the memory.</p>
  
  <p>Please, can you suggest me any suitibale solution for this case.</p>
  
  <p>here is part of python script:</p>
  
  <pre><code>      lfmt = '%Y-%m-%d %H:%M:%S'
        file = open(filename, 'rU')
        normal_line = ''
        for line in file:
          if line[0] == '[':
            ltimestamp = datetime.strptime(line[1:20], lfmt)
  
            if ltimestamp &gt;= str and ltimestamp &lt;= end:
              normal_line = 'True'
          else:
            normal_line = ''
  
        if normal_line:
          print line,
  </code></pre>