当前位置: 首页> 教育> 锐评 > 推广渠道的优缺点_遂宁市网站建设_深圳华强北最新消息_中国最新消息

推广渠道的优缺点_遂宁市网站建设_深圳华强北最新消息_中国最新消息

时间:2025/7/9 14:00:49来源:https://blog.csdn.net/AngelCryToo/article/details/145621180 浏览次数:0次
推广渠道的优缺点_遂宁市网站建设_深圳华强北最新消息_中国最新消息

目录

一、抓取普通的应用输出日志到elasticsearch

二、抓取nginx日志输出到ElasticSearch

2.1、nginx.conf设定日志输出为JSON格式

2.2、nginx.conf设定日志按天输出文件

2.3、抓取Nginx JSON到ElasticSearch配置


一、抓取普通的应用输出日志到elasticsearch

- type: log
  # 默认是 5s
  scan_frequency: 5s
  enabled: true
  encoding: utf-8
  paths:
    - /opt/mydomain.cn/log-file.log
  multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}'
  multiline.negate: true
  multiline.match: after
  tags: ["IP地址","业务名","myapi","dev"]
  fields:
    app_from: myapi-172
  fields_under_root:  true

二、抓取nginx日志输出到ElasticSearch

2.1、nginx.conf设定日志输出为JSON格式

log_format main '{ "time_local": "$time_local",''"remote_addr": "$remote_addr",''"referer": "$http_referer",''"uri": "$host$uri",''"status": $status,''"bytes": $body_bytes_sent,''"up_addr": "$upstream_addr",''"upstream_time": "$upstream_response_time",''"request_time": "$request_time"''}';

2.2、nginx.conf设定日志按天输出文件

map $time_iso8601 $logdate {'~^(?<ymd>\d{4}-\d{2}-\d{2})' $ymd;default 'date-not-found';}access_log logs/access-$logdate.log main;

2.3、抓取Nginx JSON到ElasticSearch配置

- type: log# 默认是 5sscan_frequency: 10senabled: trueencoding: utf-8paths:- /usr/local/nginx/logs/*.logjson.keys_under_root: true  # Flase会将json解析的格式存储至messages,改为true则不存储至json.overwrite_keys: true  #覆盖默认message字段,使用自定义json格式的keytags: ["11.111.11.111","nginx","dev"]fields:app_from: nginx-111fields_under_root:  true

这一么一点点配置,搞了一整天,才整明白。

关键字:推广渠道的优缺点_遂宁市网站建设_深圳华强北最新消息_中国最新消息

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: