title: Filter CloudWatch logs with Lambda Python function
body: <p>I have this code: </p>
  
  <pre><code>with open('/home/adiel/log', 'r') as f:
      for line in f:
          line = line.split()
          if line[6] in {'443', '65535'} and line[4] in {'172.18.0.5'} :
              print(line[3:7])
          elif line[6] in {'443', '65535'} and line[4] in {'172.18.0.37'}:
              print(line[3:7])
  </code></pre>
  
  <p>That returns me the right result.
  I want to change its input from /home/adiel/log to a CloudWatch Log Group named mgr. So, how can I accoplish this task?
  Thanks!</p>