old_contents: # -*- coding: utf-8 -*-
  #!/usr/bin/python
  
  import re
  
  #LOGFILE = "*.log"
  LOGFILE = "/home/pi/rpi_log.log"
  PATTERN = re.compile("\[INFO\] (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}) > (.+)\n", re.DOTALL)
  RPIINFO = ['HOSTNAME', 'IP', 'HDD', 'FREE MEM', 'CPU(\(.+\))', 'MEM(\(.+\))']
  
  CNT = 0
  
  f = open(LOGFILE,"r")
  tmp_str = ''
  rpi_info_list = []
  
  lines = f.readlines()
  for line in lines:
      if PATTERN.search(line):
          CNT+=1
          rpi_info = re.split(PATTERN, line)
  	#if len(tmp_str) > 0: print "++++++++++\n" + tmp_str + "\n++++++++++"
  	if len(tmp_str) > 0: rpi_info_list.append(tmp_str)
  	tmp_str = ''
      else:
          rpi_info = [info for info in rpi_info if len(info) > 0]
  	tmp_str += line
  print CNT
  print rpi_info_list
  
  f.close()
  
new_contents: # -*- coding: utf-8 -*-
  #!/usr/bin/python
  
  import re
  
  #LOGFILE = "*.log"
  LOGFILE = "out/rpi_log.log"
  PATTERN = re.compile("\[INFO\] (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}) > (.+)\n", re.DOTALL)
  RPIINFO = ['HOSTNAME', 'IP', 'HDD', 'FREE MEM', 'CPU(\(.+\))', 'MEM(\(.+\))']
  
  CNT = 0
  
  f = open(LOGFILE,"r")
  tmp_str = ''
  rpi_info_list = []
  
  lines = f.readlines()
  for line in lines:
      if PATTERN.search(line):
          CNT+=1
          rpi_info = re.split(PATTERN, line)
  	#if len(tmp_str) > 0: print "++++++++++\n" + tmp_str + "\n++++++++++"
  	if len(tmp_str) > 0: rpi_info_list.append(tmp_str)
  	tmp_str = ''
      else:
          rpi_info = [info for info in rpi_info if len(info) > 0]
  	tmp_str += line
  f.close()
  
  #print CNT
  #print rpi_info_list
  print "Content-type:text/html\r\n\r\n"
  print "<html>"
  print "<head>"
  print "<title>tinyosGW</title>"
  print "</head>"
  print "<body>"
  for i in rpi_info_list:
      print i
  print "</body>"
  print "</html>"
  
subject: update ParserLogFile.py