首页 > 系统相关 >把nginx的access_log以json的格式输出

把nginx的access_log以json的格式输出

时间:2023-04-24 15:58:34浏览次数:32  
标签:addr bytes time request access nginx json upstream log

# 在`nginx.conf`中添加如下配置
log_format json escape=json '{"@timestamp":"$time_iso8601",'
                      '"server_addr":"$server_addr",'
                      '"remote_addr":"$remote_addr",'
                      '"scheme":"$scheme",'
                      '"request_method":"$request_method",'
                      '"request_uri": "$request_uri",'
                      '"request_length": "$request_length",'
                      '"uri": "$uri",'
                      '"request_time":$request_time,'
                      '"body_bytes_sent":$body_bytes_sent,'
                      '"bytes_sent":$bytes_sent,'
                      '"status":"$status",'
                      '"upstream_time":"$upstream_response_time",'
                      '"upstream_host":"$upstream_addr",'
                      '"upstream_status":"$upstream_status",'
                      '"host":"$host",'
                      '"http_referer":"$http_referer",'
                      '"http_user_agent":"$http_user_agent"'
                      '}';

标签:addr,bytes,time,request,access,nginx,json,upstream,log
From: https://www.cnblogs.com/weinirumo/p/17349730.html

相关文章

  • syslog占满磁盘空间问题
    1.手动删除echo/dev/null>/var/log/syslog2.采用journald服务 https://itlanyan.com/clear-systemd-journal-logs//etc/systemd/journald.conf [Journal]#Storage=auto#Compress=yes#Seal=yes#SplitMode=uid#SyncIntervalSec=5m#RateLimitInterval=30s#RateLimit......
  • Verilog 处理方式 输入的使能信号 多次触发
    一个模块里面有输入的使能信号,但是使能信号的持续时长不一致,会出现使能信号持续时间过长,可能多次触发本模块的功能。时间过短则会不能触发,这种情况要调整本模块的输入时钟,要能采集到使能信号的上升沿。时间过长的处理思想:模块里预设一个busy信号,忙信号,接收到使能信号,且busy信号为......
  • 正的浮点数相加的示例程序 Verilog
    modulefloat_adder( input        clk, input       rst_n, input        en, input   [31:0]  aIn, input   [31:0]  bIn, outputreg     busy, outputreg   out......
  • Codeforces Beta Round 96 (Div. 1) -- C. Logo Turtle (dp,记忆化搜索)
    记忆化搜索就是暴力,多一步优化,走过的路别走了。说实话,可能是数据水了,居然能过。constintN=510;strings;intn,ans;boolst[501][501][2][50];voiddfs(intx,intidx,intdir,intk){ if(st[x][idx][dir][k])return; st[x][idx][dir][k]=1;//走过的路不走......
  • window上手nginx
    安装源地址http://nginx.org/en/download.htmlMainlineversion:开发版本Stableversion:最新稳定版本Legacyversions:老版本的稳定版本安装启动解压后运行可执行文件nginx.exe  点击运行后,会有黑框一闪而过  浏览器访问  http://localhost/ 查看是否启动成功......
  • 【Verilog HDL】常量的参数化及跨模块传递
    申明变量Verilog中申明常量主要有两种方式:parameter localparamlocalparam用法与parameter基本一致,只是localpara定义的参数通常只在所在模块范围内使用,其赋值无法被模块之外的参数定义所改变。parameter的跨模块传递parameter在同一个模块中的赋值通常有两种方式,......
  • Nginx命令(查询nginx配置文件)
    Nginx命令(查询nginx配置文件)个人博客地址:https://note.raokun.top拥抱ChatGPT,国内访问网站:https://www.playchat.topNginx是一款轻量级的Web服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,在BSD-like协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发......
  • log4j2.properties配置
    ###VIDEO_CONVERSIONLOG##logger.VIDEO_CONVERSION.name=com.isprint.am.core.privpwd.videoconverterlogger.VIDEO_CONVERSION.level=DEBUGlogger.VIDEO_CONVERSION.additivity=falselogger.VIDEO_CONVERSION.appenderRef.rolling.ref=VIDEO_CONVERSION_LOG......
  • nginx 按天生成日志
    月小升记得以前nginx没有办法读取日期,今天找到个办法居然可以。server{location~\.php${fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;include/etc/nginx/fastcgi_params;fastcgi_pass......
  • redis之哈希类型-列表类型-集合类型-有序集合-慢查询-pipeline-发布订阅-Bitmap位图-H
    目录redis之哈希类型-列表类型-集合类型-有序集合-慢查询-pipeline-发布订阅-Bitmap位图-HyperLogLog-GEO地理位置昨日内容回顾今日内容详细1哈希类型2列表类型3集合类型4有序集合5慢查询6pipeline与事务7发布订阅8Bitmap位图9HyperLogLog10GEO地理位置redis之哈希类型......