<del id="d4fwx"><form id="d4fwx"></form></del>
      <del id="d4fwx"><form id="d4fwx"></form></del><del id="d4fwx"><form id="d4fwx"></form></del>

            <code id="d4fwx"><abbr id="d4fwx"></abbr></code>
          • filebeat6.4.3采集nginx日志-創(chuàng)新互聯(lián)

            filebeat 6.4.3 采集 nginx日志

            成都創(chuàng)新互聯(lián)是專業(yè)的永州網站建設公司,永州接單;提供成都網站建設、網站設計,網頁設計,網站設計,建網站,PHP網站建設等專業(yè)做網站服務;采用PHP框架,可快速的進行永州網站開發(fā)網頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網站,專業(yè)的做網站團隊,希望更多企業(yè)前來合作!

            nginx 日志格式規(guī)范:

            將日志配置組合添加至nginx主配置文件;

             log_format  eslog  '$remote_addr - $remote_user [$time_local] "$request" '
                                  '$status $body_bytes_sent "$http_referer" '
                                  '"$http_user_agent" "$http_x_forwarded_for"';
            

            ES集群安裝插件

            集群收集nginx日志需要安裝 ingest-user-agent ,ingest-geoip ,安裝完成之后需要重啟es 服務,否則數(shù)據(jù)無法正常錄入es集群。

            /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-user-agent
            /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-geoip
            /usr/share/elasticsearch/bin/elasticsearch-plugin list

            升級java至1.8

            yum install java-1.8 -y

            安裝filebeat

            導入key

            rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

            創(chuàng)建repo 文件

            more lostash.repo

            [elastic-6.x]
            name=Elastic repository for 6.x packages
            baseurl=https://artifacts.elastic.co/packages/6.x/yum
            gpgcheck=1
            gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
            enabled=1
            autorefresh=1
            type=rpm-md

            安裝

            yum install filebeat -y

            修改filebeat主配置文件

            more /etc/filebeat/filebeat.yml

            filebeat.config:
            prospectors:
            path: ${path.config}/prospectors.d/.yml
            reload.enabled: false
            modules:
            path: /etc/filebeat/modules.d/
            .yml
            reload.enabled: false

            output.elasticsearch:
            hosts: ['10.2.3.30:9200']

            setup.kibana:
            host: "10.2.3.13:5601"

            配置filebeat nginx 模塊
            Access 日志:/data/nginxlog/eslog/es-access.*
            Error 日志:/data/nginxlog/eslog/es-error.*
            more /etc/filebeat/modules.d/nginx.yml 
            - module: nginx
              # Access logs
              access:
                enabled: true
            
                # Set custom paths for the log files. If left empty,
                # Filebeat will choose the paths depending on your OS.
                var.paths: ["/data/nginxlog/eslog/es-access.*"]
              # Error logs
              error:
                enabled: true
            
                # Set custom paths for the log files. If left empty,
                # Filebeat will choose the paths depending on your OS.
                var.paths: ["/data/nginxlog/eslog/es-error.*"]
            
            添加啟動
            systemctl enable filebeat

            開啟nginx 模塊

            cd /etc/filebeat
            
            filebeat modules enable nginx
            
            filebeat modules list
            初始化環(huán)境

            此操作會自動導入filebeat模板和nginx dashboard 到es 集群:

            Set up the initial environment:
            Loaded index template
            Loading dashboards (Kibana must be running and reachable)
            Loaded dashboards
            Loaded machine learning job configurations
            ./filebeat setup -e
            啟動服務
            systemctl start filebeat
            啟動服務報錯

            內容如下:

            Exiting: Error importing Kibana dashboards: fail to import the dashboards in Kibana: Error importing directory /usr/share/filebeat/kibana: Failed to import index-pattern: Failed to load directory /usr/share/filebeat/kibana/6/index-pattern:
              error loading /usr/share/filebeat/kibana/6/index-pattern/filebeat.json: returned 400 to import file: <nil>. Response: {"statusCode":400,"error":"Bad Request","message":"Request Timeout after 30000ms"}
            
            2018-10-31T16:35:45.659+0900    INFO    kibana/client.go:113    Kibana url: http://10.2.3.13:5601
            2018-10-31T16:37:15.664+0900    ERROR   instance/beat.go:743    Exiting: Error importing Kibana dashboards: fail to import the dashboards in Kibana: Error importing directory /usr/share/filebeat/kibana: Failed to import index-pattern: Failed to load directory /usr/share/filebeat/kibana/6/index-pattern:
              error loading /usr/share/filebeat/kibana/6/index-pattern/filebeat.json: fail to execute the HTTP POST request: Post http://10.2.3.13:5601/api/kibana/dashboards/import?force=true: net/http: request canceled (Client.Timeout exceeded while awaiting headers). Response:
            處理辦法:

            登陸kibana 進入Dev tools 刪除

            刪除舊模板
            #DELETE _template/filebeat-6.X.X
            刪除舊數(shù)據(jù)
            #DELETE filebeat-6.4.2-*
            重新導入模板:
            cd /etc/filebeat/
            filebeat setup
            Loaded index template
            Loading dashboards (Kibana must be running and reachable)
            Loaded dashboards
            Loaded machine learning job configurations
            重啟服務:
            systemctl restart filebeat

            Dashboard 效果:

            filebeat 6.4.3 采集 nginx日志

            另外有需要云服務器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

            新聞標題:filebeat6.4.3采集nginx日志-創(chuàng)新互聯(lián)
            文章位置:http://www.jbt999.com/article46/doopeg.html

            成都網站建設公司_創(chuàng)新互聯(lián),為您提供網站改版、服務器托管虛擬主機、網站內鏈網頁設計公司、網站導航

            廣告

            聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:[email protected]。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

            商城網站建設

              <del id="d4fwx"><form id="d4fwx"></form></del>
              <del id="d4fwx"><form id="d4fwx"></form></del><del id="d4fwx"><form id="d4fwx"></form></del>

                    <code id="d4fwx"><abbr id="d4fwx"></abbr></code>
                  • 成人18禁在线 | 日韩人妻无码精品免费shipin | 久草国产精品 | 久草视频2 | 国产三级精品视频 |