print 'connection success' time.sleep(30) conn.disconnect() if (__name__ == '__main__'): common_cfg = mod_conf.load('stomp.ini') self_cfg_path = 'stomp_access_log.ini' if len(sys.argv) > 1: self_cfg_path = sys.argv[1] print 'config path : %s' % self_cfg_path self_cfg = mod_conf.load(self_cfg_path) LOG_LEVEL = lm.level[self_cfg['self']['log_level']] log = lm.LoggerFactory(self_cfg['self']['log_file'], 'access_log', LOG_LEVEL, int(self_cfg['self']['log_split_h'])).getLog() print common_cfg print self_cfg from SimpleXMLRPCServer import SimpleXMLRPCServer server = SimpleXMLRPCServer( ('127.0.0.1', int(self_cfg['self']['daemon_port'])), logRequests=True) wt = WriteLogTask() wt.start() Main().start_link()
conn.set_listener('',MyListener()) while True: if not conn.is_connected(): log.info('connect to stomp server ...') conn.start() conn.connect(wait=True) conn.subscribe( destination=('/queue/%s' % self_cfg['self']['mq_destination']), id=1, ack='auto' ) log.info('connect success...') time.sleep(30) log.info('heart beat...') conn.disconnect() if(__name__=='__main__'): common_cfg = mod_conf.load('stomp.ini') self_cfg_path = 'stomp_feedback.ini' if len(sys.argv) > 1 : self_cfg_path = sys.argv[1] print 'config path : %s' % self_cfg_path self_cfg = mod_conf.load(self_cfg_path) LOG_LEVEL = lm.level[self_cfg['self']['log_level']] log = lm.LoggerFactory(self_cfg['self']['log_file'],'access_log',LOG_LEVEL).getLog() print common_cfg print self_cfg from SimpleXMLRPCServer import SimpleXMLRPCServer server = SimpleXMLRPCServer(('127.0.0.1',int(self_cfg['self']['daemon_port'])) , logRequests=True ) Main().start_link()
#/usr/bin/env python #coding=utf-8 import os.path, os, pprint, shutil, sys, uuid, string, time import traceback import StringIO import json import mod_conf import mod_log as lm import mysql.connector import datetime import redis common_cfg = mod_conf.load('access_log_analysis.ini') LOG_LEVEL = lm.level['debug'] log = lm.LoggerFactory(common_cfg['common']['log_file'], 'counter', LOG_LEVEL).getLog() token_map = {} def visit(arg, dirname, names): log.debug('dirname=%s ; arg=%s' % (dirname, arg)) for name in names: if arg != name and name.startswith('pet_access'): subname = os.path.join(dirname, name) log.debug(subname) analysis(subname) def analysis(path): try:
#/usr/bin/env python #coding=utf-8 import string, datetime, traceback, os.path, re, tornado.httpserver, tornado.ioloop, tornado.options, tornado.web, unicodedata, mysql.connector, json, uuid import mod_log as lm LOG_LEVEL = lm.level['info'] log = lm.LoggerFactory('/tmp/http_yijifen.log', 'yijifen', LOG_LEVEL).getLog() #host = '192.168.99.51' host = '123.178.27.74' conf = (host, 'pet_statistic', 'pet', '123456') biz_yijifen_template = "insert into biz_yijifen (id,cd,ct,callback)values('${id}','${cd}','${ct}','${callback}')" class MainHandler(tornado.web.RequestHandler): def initialize(self, db): db.set_autocommit(True) self.db = db def get(self): res = {} try: conn = self.db ct = self.get_argument('eventtime') #事件发生时间 mac = self.get_argument('IDFV') #IDFV值 callback = self.get_argument( 'callback_url') #http%3a%2f%2fwww.baidu.com param = dict( zip(('id', 'ct', 'callback', 'cd'), (mac, ct, callback,
conn.start() conn.connect(wait=True) conn.subscribe( destination=('/queue/%s' % self_cfg['self']['mq_destination']), id=1, ack='auto') log.info('connect success...') log.info('heart beat...') time.sleep(30) conn.disconnect() if (__name__ == '__main__'): common_cfg = mod_conf.load('stomp.ini') self_cfg_path = 'stomp_push_xmpp_pubsub.ini' if len(sys.argv) > 1: self_cfg_path = sys.argv[1] print 'config path : %s' % self_cfg_path self_cfg = mod_conf.load(self_cfg_path) LOG_LEVEL = lm.level[self_cfg['self']['log_level']] log = lm.LoggerFactory(self_cfg['self']['log_file'], 'push_xmpp', LOG_LEVEL).getLog() print common_cfg print self_cfg from SimpleXMLRPCServer import SimpleXMLRPCServer server = SimpleXMLRPCServer( ('127.0.0.1', int(self_cfg['self']['daemon_port'])), logRequests=True) Main().start_link()