用于以graylog扩展日志格式(gelf)发送消息的udp客户端
larrabee-gelfclient的Python项目详细描述
gelf client
==
python客户端,用于以graylog扩展日志格式(gelf)发送udp消息。
消息是zlib压缩的,并且支持gelf分块编码。
由于消息是用udp发送的,因此日志方法应快速返回,并且不会由于超时而引发异常。但是,由于目标主机名的DNS名称解析失败,可能会引发异常。
=udpclient(gelf_u server)
默认为socket.gethostname(),但可以重写
gelf.log('server is down',source='hostchecker')
一个字典,并将其赋给.log
data={}
data['short廑message']=“来自python的警告”
data['host']=“hostchecker”
data['level']=syslog.log廑warning
gelf.log(data)
```
http://docs.graylog.org/en/latest/pages/gelf.html gelf格式规范
==
python客户端,用于以graylog扩展日志格式(gelf)发送udp消息。
消息是zlib压缩的,并且支持gelf分块编码。
由于消息是用udp发送的,因此日志方法应快速返回,并且不会由于超时而引发异常。但是,由于目标主机名的DNS名称解析失败,可能会引发异常。
=udpclient(gelf_u server)
默认为socket.gethostname(),但可以重写
gelf.log('server is down',source='hostchecker')
一个字典,并将其赋给.log
data={}
data['short廑message']=“来自python的警告”
data['host']=“hostchecker”
data['level']=syslog.log廑warning
gelf.log(data)
```
http://docs.graylog.org/en/latest/pages/gelf.html gelf格式规范