网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

ELK+syslog+nginx访问日志收集+分词处理-创新互联

一、nginx访问日志配置:

创新互联专注于企业成都全网营销推广、网站重做改版、当阳网站定制设计、自适应品牌网站建设、H5技术商城网站开发、集团公司官网建设、外贸营销网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为当阳等各大城市提供网站开发制作服务。

1、日志格式配置:

log_format json '{"@timestamp":"$time_iso8601",'

          '"host":"$server_addr",'

          '"clientip":"$remote_addr",'

          '"size":$body_bytes_sent,'

          '"xff":"$http_x_forwarded_for",'

          '"upstreamhost":"$upstream_addr",'

          '"status":"$status",'

          '"responsetime":$request_time,'

          '"upstreamtime":"$upstream_response_time",'

          '"http_host":"$host",'

          '"url":"$uri"}';

2、访问日志配置:

access_log  syslog:server=xx.xx.xx.xx:5140 json;

二、logstash配置

input {

   syslog{

      port => "5140"

     }

}

filter {

   json {

     source =>"message"

     remove_field => ["message"]

     }

}

output {

     elasticsearch { hosts => ['xx.xx.xx.xx:9200','xx.xx.xx.xx:9200']

             index => 'nginx_rfd-%{+YYYY.MM.dd.HH}'

             template => "/usr/local/logstash/nginx.json"

             template_name => "nginx_*"

             template_overwrite => true

            }

}

注意index名称要包含到template_name里

三、自定义mappings

cat /usr/local/logstash/nginx.json

{

  "template": "nginx_*",

  "order":1,

  "settings": { "index.refresh_interval" : "60s" },

  "mappings": {

    "_default_": {

      "_all" : { "enabled" : false },

      "properties": {

        "@timestamp" : { "type" : "date" },

        "@version" : { "type" : "integer", "index" : "not_analyzed" },

        "url": {

          "type": "string",

          "index": "not_analyzed"

        },

        "host": {

          "type": "ip",

          "index": "not_analyzed"

        },

        "clientip": {

          "type": "ip",

          "index": "not_analyzed"

        },

        "size": {

          "type": "integer"

        },

        "xff": {

          "type": "string",

          "index": "not_analyzed"

        },

        "upstreamhost": {

          "type": "string",

          "index": "not_analyzed"

        },

        "http_host": {

          "type": "string",

          "index": "not_analyzed"

        },

        "status": {

          "type": "integer"

        },

        "responseTime": {

          "type": "string",

          "index": "not_analyzed"

        },

        "upstreamtime": {

          "type": "string",

          "index": "not_analyzed"

        }

      }

    }

  }

}

四、生成统计图形

ELK+syslog+nginx访问日志收集+分词处理

五、参考文档

https://elasticsearch.cn/article/154

http://blog.csdn.net/choelea/article/details/53320140

http://www.cnblogs.com/hanyifeng/p/5860731.html

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网站题目:ELK+syslog+nginx访问日志收集+分词处理-创新互联
文章地址:http://bjjierui.cn/article/doccpc.html

其他资讯