title: I want to retrieve multiple logs from a server with minimum lines of code
body: <p>I would like to retrieve multiple log files from an Ubuntu server (using Python 2.7 on win 7 machine) without having to write verbose, repetitive code. I'm sure I can use a loop to accomplish this, but I can't come up with any valid solutions (neophyte programmer). I need the direction of someone more seasoned than I. In advanced, I appreciate the help. Below is the code I'm using in my script to log into a server and retrieve one file. Below is a sample path of files I would like to retrieve at the same time:</p>
  
  <p>/var/log/apache/a.log
  /var/log/apache/e.log
  /var/opt/smart/log/me.log
  /var/opt/smart/log/se.log</p>
  
  <p>I have several more paths, but I imagine you get the idea. Below is the code used to log into the server:</p>
  
  <pre><code>def do_siteserver(self, line):
     import paramiko
  
  
  
     paramiko.util.log_to_file('c:\Python27\paramiko-wininst.log')
  
     host = '10.5.48.65'
     port = 22
     transport = paramiko.Transport((host,port))
  
  
     while True:
          try:
             print '\n'
             passW = raw_input("Enter the SiteServer weekly password: ") 
             password = passW
             username = 'gilbert'
             print '\n'
             print 'Establishing SFTP connection to: ', host + ':' + str(port), '...'
             transport.connect(username = username, password = password)
             sftp = paramiko.SFTPClient.from_transport(transport)
             print 'Authorization Successful!!!'
  
             filepath = '/var/log/apache2/error.log'
             localpath = 'C:\\remote\\NewFile.log'
             sftp.get(filepath, localpath)
             sftp.close()
             transport.close()
             break
  
  
          except:
             print '\n'
             print "Authorization Failed!!!"
             break
  </code></pre>