コード例 #1
0
ファイル: eventgenprof.py プロジェクト: Kintyre/eventgen
    logger.info("Starting eventgen")

    # 5/6/12 CS use select to listen for input on stdin
    # if we timeout, assume we're not splunk embedded
    # Only support standalone mode on Unix due to limitation with select()
    if os.name != "nt":
        rlist, _, _ = select([sys.stdin], [], [], 5)
        if rlist:
            sessionKey = sys.stdin.readline().strip()
        else:
            sessionKey = ""
    else:
        sessionKey = sys.stdin.readline().strip()

    if sessionKey == "debug":
        c.makeSplunkEmbedded(runOnce=True)
    elif len(sessionKey) > 0:
        c.makeSplunkEmbedded(sessionKey=sessionKey)

    c.parse()

    sampleTimers = []

    if c.runOnce:
        logger.info("Entering debug (single iteration) mode")

    # Hopefully this will catch interrupts, signals, etc
    # To allow us to stop gracefully
    t = Timer(1.0, interruptcatcher=True)

    for s in c.samples:
コード例 #2
0
    streamHandler.setFormatter(formatter)
    logobj.handlers = []
    logobj.addHandler(streamHandler)
    from eventgenconfig import EventgenAdapter
    adapter = EventgenAdapter(logobj, {'sample': 'null', 'module': 'main'})
    logger = adapter

    logobj.info('Starting eventgen')

    # Start the stream, only once for the whole program
    print '<stream>\n'

    splunkconf = get_config()
    # logger.debug("Splunkconf: %s" % pprint.pformat(splunkconf))
    if 'session_key' in splunkconf:
        c.makeSplunkEmbedded(sessionKey=splunkconf['session_key'])
    else:
        raise ValueError('sessionKey missing from Splunk stdin config')

    c.parse()

    # Hopefully this will catch interrupts, signals, etc
    # To allow us to stop gracefully
    t = Timer(1.0, interruptcatcher=True)

    for s in c.samples:
        if s.interval > 0 or s.mode == 'replay':
            logger.info("Creating timer object for sample '%s' in app '%s'" %
                        (s.name, s.app))
            t = Timer(1.0, s)
            c.sampleTimers.append(t)
コード例 #3
0
    logger.info('Starting eventgen')

    # 5/6/12 CS use select to listen for input on stdin
    # if we timeout, assume we're not splunk embedded
    # Only support standalone mode on Unix due to limitation with select()
    if os.name != "nt":
        rlist, _, _ = select([sys.stdin], [], [], 1)
        if rlist:
            sessionKey = sys.stdin.readline().strip()
        else:
            sessionKey = ''
    else:
        sessionKey = sys.stdin.readline().strip()

    if len(sessionKey) > 0:
        c.makeSplunkEmbedded(sessionKey=sessionKey)

    c.parse()
    replacements = [parse_arg(arg) for arg in sys.argv[1:] if parse_arg(arg)]
    update_config(replacements, c)

    t = Timer(1.0, interruptcatcher=True)

    for s in c.samples:
        if s.interval > 0 or s.mode == 'replay':
            logger.info("Creating timer object for sample '%s' in app '%s'" % (s.name, s.app) )
            t = Timer(1.0, s)
            c.sampleTimers.append(t)


    first = True
コード例 #4
0
    logger.info('Starting eventgen')

    # 5/6/12 CS use select to listen for input on stdin
    # if we timeout, assume we're not splunk embedded
    # Only support standalone mode on Unix due to limitation with select()
    if os.name != "nt":
        rlist, _, _ = select([sys.stdin], [], [], 5)
        if rlist:
            sessionKey = sys.stdin.readline().strip()
        else:
            sessionKey = ''
    else:
        sessionKey = sys.stdin.readline().strip()

    if sessionKey == 'debug':
        c.makeSplunkEmbedded(runOnce=True)
    elif len(sessionKey) > 0:
        c.makeSplunkEmbedded(sessionKey=sessionKey)

    c.parse()

    sampleTimers = []

    if c.runOnce:
        logger.info('Entering debug (single iteration) mode')

    # Hopefully this will catch interrupts, signals, etc
    # To allow us to stop gracefully
    t = Timer(1.0, interruptcatcher=True)

    for s in c.samples:
コード例 #5
0
    logobj.handlers = [ ]
    logobj.addHandler(streamHandler)
    from eventgenconfig import EventgenAdapter
    adapter = EventgenAdapter(logobj, {'sample': 'null', 'module': 'main'})
    logger = adapter

    logobj.info('Starting eventgen')

    # Start the stream, only once for the whole program
    print '<stream>\n'
        

    splunkconf = get_config()
    # logger.debug("Splunkconf: %s" % pprint.pformat(splunkconf))
    if 'session_key' in splunkconf:
        c.makeSplunkEmbedded(sessionKey=splunkconf['session_key'])
    else:
        raise ValueError('sessionKey missing from Splunk stdin config')
        
    c.parse()

    # Hopefully this will catch interrupts, signals, etc
    # To allow us to stop gracefully
    t = Timer(1.0, interruptcatcher=True)

    for s in c.samples:
        if s.interval > 0 or s.mode == 'replay':
            logger.info("Creating timer object for sample '%s' in app '%s'" % (s.name, s.app) )    
            t = Timer(1.0, s) 
            c.sampleTimers.append(t)