syslog输出器

功能描述

syslog输出器能够将程序运行中产生的日志内容输出远端的syslog服务器。

OpenAPI配置日志

配置参数说明

参数说明是否必填默认值值可能性
name实例名string
driver驱动名"syslog_output"
description描述string
network所使用的网络协议, 如:tcp,udp,unix["tcp","udp","unix"]
address远端syslog服务器的地址string
level日志等级["error","warn","info","debug","trace"]
typeformatter的类型"line"["line","json"]
formatterformatter的输出内容object

注意

  • formatter的配置教程点此进行跳转

返回参数说明

参数名类型是否必含说明
idstring实例id
namestring实例名
driverstring驱动名
descriptionstring描述
professionstring模块名
createstring创建时间
updatestring更新时间
networkstring所使用的网络协议, 如:tcp,udp,unix
addressstring远端syslog服务器的地址
levelstring日志等级
typestringformatter的类型
formatterobjectformatter的输出内容

创建syslog输出器示例

curl -X POST  \
  'http://127.0.0.1:9400/api/output' \
  -H 'Content-Type:application/json' \
  -d '{
	"name": "demo_syslog",
	"driver": "syslog_output",
	"network": "tcp",
	"address": "127.0.0.1:514",
	"level": "info",
	"type": "line",
	"formatter": {
		"fields": ["$request_id", "$request", "$status", "@time", "@proxy", "$response_time"],
		"time": ["$msec", "$time_iso8601", "$time_local"],
		"proxy": ["$proxy_uri", "$proxy_scheme", "$proxy_addr"]
	}
}'

返回结果示例

{
	"address": "127.0.0.1:514",
	"create": "2022-06-14 14:56:15",
	"description": "",
	"driver": "syslog_output",
	"formatter": {
		"fields": ["$request_id", "$request", "$status", "@time", "@proxy", "$response_time"],
		"proxy": ["$proxy_uri", "$proxy_scheme", "$proxy_addr"],
		"time": ["$msec", "$time_iso8601", "$time_local"]
	},
	"id": "demo_syslog@output",
	"level": "info",
	"name": "demo_syslog",
	"network": "tcp",
	"profession": "output",
	"type": "line",
	"update": "2022-06-14 14:56:15"
}

syslog输出器使用

syslog输出器可用于access-log插件的日志输出,点此跳转至access-log插件。