コード例 #1
0
ファイル: handler.py プロジェクト: saluker/graypy
 def __init__(self, host, port=12201, chunk_size=WAN_CHUNK,
         debugging_fields=True, extra_fields=True, fqdn=False):
     self.debugging_fields = debugging_fields
     self.extra_fields = extra_fields
     self.chunk_size = chunk_size
     self.fqdn = fqdn
     DatagramHandler.__init__(self, host, port)
コード例 #2
0
ファイル: handler.py プロジェクト: wayswei/graypy
 def __init__(self, host, port=12201, chunk_size=WAN_CHUNK,
         debugging_fields=True, extra_fields=True, fqdn=False,
         localname=None, facility=None, level_names=False, compress=True):
     BaseGELFHandler.__init__(self, host, port, chunk_size,
                              debugging_fields, extra_fields, fqdn,
                              localname, facility, level_names, compress)
     DatagramHandler.__init__(self, host, int(port))
コード例 #3
0
    def __init__(self,
                 host,
                 port=12202,
                 gelf_chunker=GELFWarningChunker(),
                 **kwargs):
        """Initialize the GELFUDPHandler

        .. note::
            By default a :class:`.handler.GELFWarningChunker` is used as the
            ``gelf_chunker``. Thus, GELF messages that chunk overflow will
            issue a :class:`.handler.GELFChunkOverflowWarning` and will be
            dropped.

        :param host: GELF UDP input host.
        :type host: str

        :param port: GELF UDP input port.
        :type port: int

        :param gelf_chunker: :class:`.handler.BaseGELFChunker` instance to
            handle chunking larger GELF messages.
        :type gelf_chunker: GELFWarningChunker
        """
        BaseGELFHandler.__init__(self, **kwargs)
        DatagramHandler.__init__(self, host, port)
        self.gelf_chunker = gelf_chunker
コード例 #4
0
    def __init__(self, host, port=5959, message_type='logstash', fqdn=False, version=0, tags=None):
        DatagramHandler.__init__(self, host, port)

        tags = tags or []

        if version == 1:
            self.formatter = formatter.LogstashFormatterVersion1(message_type, tags, fqdn)
        else:
            self.formatter = formatter.LogstashFormatterVersion0(message_type, tags, fqdn)
コード例 #5
0
ファイル: handler.py プロジェクト: diezguerra/graypy
 def __init__(self, host, port=12201, chunk_size=WAN_CHUNK,
         debugging_fields=True, extra_fields=True, fqdn=False, 
         localname=None, facility=None):
     self.debugging_fields = debugging_fields
     self.extra_fields = extra_fields
     self.chunk_size = chunk_size
     self.fqdn = fqdn
     self.localname = localname
     self.facility = facility
     DatagramHandler.__init__(self, host, port)
コード例 #6
0
ファイル: __init__.py プロジェクト: pomidoroshev/elk
 def __init__(self, host, port=9700, max_packet_size=64*1024,
              debugging_fields=False, extra_fields=True, fqdn=False,
              localname=None, service="logstash", type="logs"):
     self.debugging_fields = debugging_fields
     self.extra_fields = extra_fields
     self.max_packet_size = max_packet_size
     self.fqdn = fqdn
     self.localname = localname
     self.service = service
     self.type = type
     DatagramHandler.__init__(self, host, port)
コード例 #7
0
ファイル: handler.py プロジェクト: thangnvaltplus/elpylog
 def __init__(self, host, port=9700, max_packet_size=64*1024,
              debugging_fields=False, extra_fields=True, fqdn=False,
              localname=None, index="logstash-%Y.%m.%d", type="logs"):
     self.debugging_fields = debugging_fields
     self.extra_fields = extra_fields
     self.max_packet_size = max_packet_size
     self.fqdn = fqdn
     self.localname = localname
     self.index = index
     self.type = type
     DatagramHandler.__init__(self, host, port)
コード例 #8
0
ファイル: handler.py プロジェクト: ress/graypy
 def __init__(self, host, port, chunk_size=WAN_CHUNK):
     self.chunk_size = chunk_size
     # skip_list is used to filter additional fields in a log message.
     # It contains all attributes listed in
     # http://docs.python.org/library/logging.html#logrecord-attributes
     # plus exc_text, which is only found in the logging module source,
     # and id, which is prohibited by the GELF format.
     self.skip_list = set(['args', 'asctime', 'created', 'exc_info',  'exc_text',
         'filename', 'funcName', 'id', 'levelname', 'levelno', 'lineno',
         'module', 'msecs', 'msecs', 'message', 'msg', 'name', 'pathname',
         'process', 'processName', 'relativeCreated', 'thread', 'threadName'])
     DatagramHandler.__init__(self, host, port)
コード例 #9
0
ファイル: handler.py プロジェクト: jjhooper/graypy
 def __init__(self,
              host,
              port=12201,
              chunk_size=WAN_CHUNK,
              debugging_fields=True,
              extra_fields=True,
              fqdn=False):
     self.debugging_fields = debugging_fields
     self.extra_fields = extra_fields
     self.chunk_size = chunk_size
     self.fqdn = fqdn
     DatagramHandler.__init__(self, host, port)
コード例 #10
0
 def __init__(self,
              host,
              port=5959,
              message_type='logstash',
              fqdn=False,
              version=0):
     DatagramHandler.__init__(self, host, port)
     if version == 1:
         self.formatter = formatter.LogstashFormatterVersion1(
             message_type, [], fqdn)
     else:
         self.formatter = formatter.LogstashFormatterVersion0(
             message_type, [], fqdn)
コード例 #11
0
    def __init__(self, host, port, compress=True, chunk_size=1300, **kwargs):
        """
        Logging handler that transforms each record into GELF (graylog extended log format) and sends it over UDP.
        If message length exceeds chunk_size, the message splits into multiple chunks.
        The number of chunks must be less than 128.

        :param host: GELF UDP input host
        :param port: GELF UDP input port
        :param compress: compress message before sending it to the server or not
        :param chunk_size: length of a chunk, should be less than the MTU (maximum transmission unit)
        """

        DatagramHandler.__init__(self, host, port)
        BaseHandler.__init__(self, compress=compress, **kwargs)

        self.chunk_size = chunk_size
コード例 #12
0
    def __init__(self, host, port=12202, chunk_size=WAN_CHUNK, **kwargs):
        """Initialize the GELFUDPHandler

        :param host: GELF UDP input host.
        :type host: str

        :param port: GELF UDP input port.
        :type port: int

        :param chunk_size: Message chunk size. Messages larger than this
            size will be sent to Graylog in multiple chunks.
        :type chunk_size: int
        """
        self.chunk_size = chunk_size

        BaseGELFHandler.__init__(self, **kwargs)
        DatagramHandler.__init__(self, host, port)
コード例 #13
0
ファイル: handlers.py プロジェクト: tinedel/pygelf
    def __init__(self, host, port, compress=True, chunk_size=1300, **kwargs):
        """
        Logging handler that transforms each record into GELF (graylog extended log format) and sends it over UDP.
        If message length exceeds chunk_size, the message splits into multiple chunks.
        The number of chunks must be less than 128.

        :param host: GELF UDP input host
        :param port: GELF UDP input port
        :param compress: compress message before send it to the server or not
        :param chunk_size: length of a chunk, should be less than the MTU (maximum transmission unit)
        """

        DatagramHandler.__init__(self, host, port)
        BaseHandler.__init__(self, **kwargs)

        self.compress = compress
        self.chunk_size = chunk_size
コード例 #14
0
ファイル: log_handler.py プロジェクト: sbfksmq/flylog
    def __init__(self, host=None, port=None, source=None, role_list=None):
        DatagramHandler.__init__(self, host or constants.HOST, port
                                 or constants.PORT)

        # source_ip
        cls = self.__class__
        if not cls.source_ip:
            try:
                # 一步步来,这样第二步报错时,起码也把名字设置上了
                cls.source_ip = socket.gethostname()
                # 有些电脑上会很慢,还是不用了,就用名字算了
                # cls.source_ip = socket.gethostbyname(cls.source_ip)
            except:
                pass

            cls.source_ip = cls.source_ip or 'none'

        self.source = source
        self.role_list = role_list
コード例 #15
0
ファイル: log_handler.py プロジェクト: dantezhu/flylog
    def __init__(self, host=None, port=None, source=None, role_list=None):
        DatagramHandler.__init__(self,
                                 host or constants.HOST,
                                 port or constants.PORT)

        # source_ip
        cls = self.__class__
        if not cls.source_ip:
            try:
                # 一步步来,这样第二步报错时,起码也把名字设置上了
                cls.source_ip = socket.gethostname()
                # 有些电脑上会很慢,还是不用了,就用名字算了
                # cls.source_ip = socket.gethostbyname(cls.source_ip)
            except:
                pass

            cls.source_ip = cls.source_ip or 'none'

        self.source = source
        self.role_list = role_list
コード例 #16
0
 def __init__(self,
              host,
              port,
              measurement,
              debugging_fields=None,
              extra_fields=True,
              localname=None,
              fqdn=False,
              global_tags=None,
              sock=None):
     DatagramHandler.__init__(self, host, int(port))
     self.measurement = measurement
     self.debugging_fields = debugging_fields
     self.extra_fields = extra_fields
     self.fqdn = fqdn
     self.localname = localname
     self.global_tags = global_tags.copy() if global_tags else {}
     for tag in self.global_tags:
         if tag in RESERVED_TAGS:
             raise ValueError("{!r} in global_tags impossible".format(tag))
     self.sock = sock
コード例 #17
0
ファイル: handler.py プロジェクト: nsmfoo/python-logstash
 def __init__(self, host, port=5959, message_type="logstash", fqdn=False, version=0):
     DatagramHandler.__init__(self, host, port)
     if version == 1:
         self.formatter = formatter.LogstashFormatterVersion1(message_type, [], fqdn)
     else:
         self.formatter = formatter.LogstashFormatterVersion0(message_type, [], fqdn)
コード例 #18
0
ファイル: handler.py プロジェクト: colinn/graypy
 def __init__(self, host, port, chunk_size=WAN_CHUNK):
     self.chunk_size = chunk_size
     DatagramHandler.__init__(self, host, port)
コード例 #19
0
 def __init__(self, host, port, machine_id):
     DatagramHandler.__init__(self, host, port)
     self.machine_id = machine_id
コード例 #20
0
ファイル: handlers.py プロジェクト: lichtwellenreiter/imonmsc
 def __init__(self, host, port, signature=None):
     SplunkTcpHandler.__init__(self, host, port, signature)
     DatagramHandler.__init__(self, host, port)
コード例 #21
0
 def __init__(self, host, port=5959, message_type='logstash', fqdn=False):
     self.message_type = message_type
     self.fqdn = fqdn
     DatagramHandler.__init__(self, host, port)
コード例 #22
0
ファイル: handler.py プロジェクト: garethr/graypy
 def __init__(self, host, port, chunk_size=WAN_CHUNK, debugging_fields=True):
     self.debugging_fields = debugging_fields
     self.chunk_size = chunk_size
     DatagramHandler.__init__(self, host, port)
コード例 #23
0
ファイル: logutil.py プロジェクト: johnhw/mgsharedcontrol
 def __init__(self, host, port):
     DatagramHandler.__init__(self, host, port)
コード例 #24
0
ファイル: handler.py プロジェクト: radeksimko/python-logstash
 def __init__(self, host, port=5959, message_type="logstash", fqdn=False, version=0):
     self.message_type = message_type
     self.fqdn = fqdn
     self.version = version
     DatagramHandler.__init__(self, host, port)
コード例 #25
0
 def __init__(self, host, port=5959, message_type='logstash', fqdn=False):
     self.message_type = message_type
     self.fqdn = fqdn
     DatagramHandler.__init__(self, host, port)
コード例 #26
0
 def __init__(self, topic, host, port):
     self.topic = topic
     DatagramHandler.__init__(self, host, port)
コード例 #27
0
ファイル: handlers.py プロジェクト: hiidef/pylogd
 def __init__(self, path, host='localhost', port=8126):
     port = int(port)
     self.path = path
     # the eventual base of DatagramHandler is not new-style
     DatagramHandler.__init__(self, host, port)
コード例 #28
0
ファイル: handler.py プロジェクト: katraev/graypy
 def __init__(self, host, port, chunk_size=WAN_CHUNK, debugging_fields=True):
     self.debugging_fields = debugging_fields
     self.chunk_size = chunk_size
     DatagramHandler.__init__(self, host, port)