def main(): mysql_init() connect2gearman() connect2redis(host="127.0.0.1") RecvLog.recv_redis_log() # collect_log() pass
def redis_logs2sqlList(): mysql_init() myredis.connect2redis(host='127.0.0.1') while True: sql_str = myredis.redis_q.get('BiglogSqlList') sql_dic = json.loads(sql_str) sql = sql_dic['sql'] args = sql_dic['args'] biglog_mysql.mysql_instance.insert_many_log(sql,args)
data = myredis.redis_q.get('BiglogDict') log_info = json.loads(data) # print log_info biglog_rl.record_log_info(log_info) print "exit..." def _stop(self): global time_str global time_unix self.thread_stop = True # print biglog_rl.log insert_log_time = {} insert_log_time['time_str'] = time_str insert_log_time['time_num'] = time_unix insert_log_time['UNIT'] = 'second' DisplayLogs.display_log_summary(biglog_rl.log,biglog_rl.log_key,insert_log_time) biglog_rl._clear() if __name__ == '__main__': Watcher() connect2gearman() myredis.connect2redis(host='127.0.0.1') biglog_rl = RecordLogInfo() while True: time_str = time.strftime('%Y-%m-%d:%H:%M:%S',time.localtime(time.time())) time_unix = int(time.mktime(datetime.datetime.now().timetuple())) thread1 = BiglogTimer() thread1.start() time.sleep(10) thread1._stop()
biglog_rl.record_log_info(log_info) print "exit..." def _stop(self): global time_str global time_unix self.thread_stop = True # print biglog_rl.log insert_log_time = {} insert_log_time['time_str'] = time_str insert_log_time['time_num'] = time_unix insert_log_time['UNIT'] = 'second' DisplayLogs.display_log_summary(biglog_rl.log, biglog_rl.log_key, insert_log_time) biglog_rl._clear() if __name__ == '__main__': Watcher() connect2gearman() myredis.connect2redis(host='127.0.0.1') biglog_rl = RecordLogInfo() while True: time_str = time.strftime('%Y-%m-%d:%H:%M:%S', time.localtime(time.time())) time_unix = int(time.mktime(datetime.datetime.now().timetuple())) thread1 = BiglogTimer() thread1.start() time.sleep(10) thread1._stop()
def redis_worker(): myredis.connect2redis(host='127.0.0.1') mysql_init() while True: db_name = myredis.redis_q.get('BiglogDomainDB') DomainDB.db_exists(db_name)
def redis_logs2sql(): mysql_init() myredis.connect2redis(host='127.0.0.1') while True: sql_cmd = myredis.redis_q.get('BiglogSql') biglog_mysql.mysql_instance.insert_log(sql_cmd)
def main(): connect2gearman() connect2redis(host='127.0.0.1') biglog_rv = RecvLog.recv_udp_log()