mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 22:06:38 +08:00
e49078ac3b
- Agent 访问日志上报 user_agent,OpenResty log_format 输出 http_user_agent - of_node_access_logs 新增 user_agent 列并写入 ClickHouse - 访问日志概览新增:设备类型饼图、状态码饼图、浏览器/OS/User-Agent 排行 - 日志明细列表增加 User-Agent 列 - 扩展 UA 解析工具(browser/os/device)并支持 CLI 识别
67 lines
3.0 KiB
Go
67 lines
3.0 KiB
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package model
|
|
|
|
import "time"
|
|
|
|
// OpenFlareOption is the key/value DTO used by the OpenFlare option API surface.
|
|
// Key 与 w_system_configs.key 一致(snake_case)。此类型仅作为
|
|
// /api/v1/d/option 接口的请求/响应载体,不再映射到独立的 of_options 表。
|
|
type OpenFlareOption struct {
|
|
Key string `json:"key"`
|
|
Value string `json:"value"`
|
|
}
|
|
|
|
// StartTime records process start time (seconds) for the public /status endpoint.
|
|
var StartTime = time.Now().Unix()
|
|
|
|
// DefaultOpenRestyMainConfigTemplate 是 OpenResty 主配置模板的内置默认值。
|
|
// 当 SystemConfig 中缺失 openresty_main_config_template 时作为兜底使用。
|
|
const DefaultOpenRestyMainConfigTemplate = `# This file is generated by OpenFlare. Do not edit manually.
|
|
user openflare;
|
|
worker_processes {{OpenRestyWorkerProcesses}};
|
|
worker_rlimit_nofile {{OpenRestyWorkerRlimitNofile}};
|
|
pid __OPENFLARE_PID_PATH__;
|
|
error_log {{OpenRestyErrorLogPath}} warn;
|
|
|
|
events {
|
|
worker_connections {{OpenRestyWorkerConnections}};
|
|
{{OpenRestyEventsUseDirective}}{{OpenRestyEventsMultiAcceptDirective}}}
|
|
|
|
http {
|
|
include mime.types;
|
|
default_type application/octet-stream;
|
|
server_tokens off;
|
|
client_body_temp_path __OPENFLARE_NGINX_CACHE_DIR__/client_temp;
|
|
proxy_temp_path __OPENFLARE_NGINX_CACHE_DIR__/proxy_temp;
|
|
fastcgi_temp_path __OPENFLARE_NGINX_CACHE_DIR__/fastcgi_temp;
|
|
uwsgi_temp_path __OPENFLARE_NGINX_CACHE_DIR__/uwsgi_temp;
|
|
scgi_temp_path __OPENFLARE_NGINX_CACHE_DIR__/scgi_temp;
|
|
{{OpenRestyConnectionUpgradeMap}}{{OpenRestyDefaultServerBlock}} log_format openflare_json escape=json '{"ts":"$time_iso8601","host":"$host","path":"$request_uri","remote_addr":"$remote_addr","status":$status,"request_time":$request_time,"bytes_sent":$body_bytes_sent,"request_length":$request_length,"user_agent":"$http_user_agent"}';
|
|
access_log {{OpenRestyAccessLogPath}} openflare_json;
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
tcp_nodelay on;
|
|
keepalive_timeout {{OpenRestyKeepaliveTimeout}};
|
|
keepalive_requests {{OpenRestyKeepaliveRequests}};
|
|
client_header_timeout {{OpenRestyClientHeaderTimeout}};
|
|
client_body_timeout {{OpenRestyClientBodyTimeout}};
|
|
client_max_body_size {{OpenRestyClientMaxBodySize}};
|
|
large_client_header_buffers {{OpenRestyLargeClientHeaderBuffers}};
|
|
send_timeout {{OpenRestySendTimeout}};
|
|
proxy_connect_timeout {{OpenRestyProxyConnectTimeout}};
|
|
proxy_send_timeout {{OpenRestyProxySendTimeout}};
|
|
proxy_read_timeout {{OpenRestyProxyReadTimeout}};
|
|
proxy_request_buffering {{OpenRestyProxyRequestBuffering}};
|
|
proxy_buffering {{OpenRestyProxyBuffering}};
|
|
proxy_buffers {{OpenRestyProxyBuffers}};
|
|
proxy_buffer_size {{OpenRestyProxyBufferSize}};
|
|
proxy_busy_buffers_size {{OpenRestyProxyBusyBuffersSize}};
|
|
gzip {{OpenRestyGzip}};
|
|
gzip_min_length {{OpenRestyGzipMinLength}};
|
|
gzip_comp_level {{OpenRestyGzipCompLevel}};
|
|
{{OpenRestyResolverDirective}}{{OpenRestyCacheBlock}} include {{OpenRestyRouteConfigInclude}};
|
|
}
|
|
`
|