日志示例
{"remote_addr":"11.50.28.61","remote_user":"-","time_local":"14/Apr/2020:11:06:05 +0800","request":"GET /v2/1.json? HTTP/1.1","status":"200","body_bytes_sent":"1283","http_referer":"http://www.abc.com","http_user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15","http_x_forwarded_for":"114.114.113.113","host":"www.abc.com","request_time":"0.024","upstream_addr":"192.168.0.24:8080","upstream_response_time":"0.024","scheme":"https","request_body":"-","host_flag":"www.abc.com","uid":"2f7","http_x_forwarded_proto":"-","cookie":"-"}
[global_tags] [agent] interval = "10s" round_interval = true metric_batch_size = 1000 metric_buffer_limit = 10000 collection_jitter = "0s" flush_interval = "10s" flush_jitter = "0s" precision = "" hostname = "" omit_hostname = false [[outputs.influxdb]] urls = ["http://172.17.0.203:8086"] database = "api" [[processors.converter]] [processors.converter.fields] float = ["upstream_response_time"] [[processors.regex]] [[processors.regex.tags]] key = "request" pattern = "^[A-Z]+ ([^?\s]+)?.*$" replacement = "${1}" [[inputs.tail]] files = ["/data/logs/nginx_logs/*.access.*.log"] data_format = "json" json_name_key = "host" tag_keys = ["status","request"] json_string_fields = ["upstream_response_time"]