亚洲精品中文免费|亚洲日韩中文字幕制服|久久精品亚洲免费|一本之道久久免费

      
      

            <dl id="hur0q"><div id="hur0q"></div></dl>

                一文記錄Telegraf解析nginx日志

                文檔記錄Telegraf解析nginx access.log的相關(guān)內(nèi)容

                Tail Input Plugin

                Tail Input Plugin 是 Telegraf項(xiàng)目 眾多Inputs插件之一。Tail Input Plugin 監(jiān)聽一個日志文件并解析該文件的每個日志變更。默認(rèn)情況下,tail 插件的行為類似于以下 Unix tail 命令

                tail -F –lines=0 myfile.log

                Telegraf收集nginx access.log 相當(dāng)于Unix tail命令:

                tail -F –lines=0 access.log

                并使用grok格式來解析日志。除此之外,Telegraf Tail Input Plugin支持多種 Data Format細(xì)節(jié)東西可以跟下源碼,下面直接記錄運(yùn)行配置。

                配置

                telegraf.conf

                [agent] interval = “10s” round_interval = true metric_batch_size = 1000 metric_buffer_limit = 10000 collection_jitter = “0s” flush_interval = “10s” flush_jitter = “0s” precision = “” hostname = “” omit_hostname = false[[inputs.tail]] files = [“/Users/enic/github/telegraf/testdata/access.log”]# from_beginning = false from_beginning = true grok_patterns = [“%{COMMON_LOG_FORMAT}”] name_override = “nginx_access_log” grok_custom_pattern_files = [] grok_custom_patterns = ”’ NGINX_ACCESS_LOG %{IP:remote_addr} – (-|%{WORD:remote_user}) [%{HTTPDATE:time_local}] %{QS:request} %{NUMBER:status:int} %{NUMBER:body_bytes_sent:int} %{QS:referrer} %{QS:agent} %{IPORHOST:xforwardedfor} %{IPORHOST:host} %{QS:upstream_addr} (-|%{NUMBER:upstream_status:int}) %{BASE10NUM:request_time:float} (-|%{BASE10NUM:upstream_response_time:float}) %{QS:cookie_uin} %{QS:cookie_luin} ”’ grok_timezone = “Local” data_format = “grok”[[outputs.file]] files = [“/Users/enic/github/telegraf/testdata/outputs.log”]

                access.log

                10.10.10.10 – – [19/Apr/2022:03:17:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:17:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:17:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:17:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:17:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:17:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:17:44 +0800] “POST /qps HTTP/1.1” 504 3693 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:17:54 +0800] “POST /latency HTTP/1.1” 504 3693 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.100 – – [19/Apr/2022:03:18:37 +0800] “GET / HTTP/1.1” 200 1839 “-” “Expanse, a Palo Alto Networks company, searches across the global IPv4 space multiple times per day to identify customers’ presences on the Internet. If you would like to be excluded from our scans, please send IP addresses/domains to: scaninfo@paloaltonetworks.com” “-“10.10.10.10 – – [19/Apr/2022:03:18:44 +0800] “POST /qps HTTP/1.1” 504 3693 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:54 +0800] “POST /latency HTTP/1.1” 504 3693 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:19:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:19:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:19:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:19:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:19:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:19:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:19:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:19:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“10.10.10.10 – – [19/Apr/2022:03:18:34 +0800] “POST /user/login HTTP/1.1” 400 63 “-” “Go-http-client/1.1” “-“

                操作

                cd telegrafmake./telegraf –config=/Users/enic/github/telegraf/testdata/telegraf.conf

                output展示

                nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST request=”/user/login”,http_version=1.1,ident=”-“,auth=”-“,resp_bytes=63i,client_ip=”10.10.10.10″ 1650309454000000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST request=”/user/login”,resp_bytes=63i,client_ip=”10.10.10.10″,ident=”-“,auth=”-“,http_version=1.1 1650309454001000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST ident=”-“,request=”/user/login”,auth=”-“,http_version=1.1,resp_bytes=63i,client_ip=”10.10.10.10″ 1650309454002000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST http_version=1.1,client_ip=”10.10.10.10″,ident=”-“,resp_bytes=63i,auth=”-“,request=”/user/login” 1650309454003000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST client_ip=”10.10.10.10″,auth=”-“,ident=”-“,request=”/user/login”,http_version=1.1,resp_bytes=63i 1650309454004000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST ident=”-“,auth=”-“,request=”/user/login”,resp_bytes=63i,client_ip=”10.10.10.10″,http_version=1.1 1650309454005000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=504,verb=POST auth=”-“,request=”/qps”,http_version=1.1,resp_bytes=3693i,client_ip=”10.10.10.10″,ident=”-” 1650309464000000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=504,verb=POST ident=”-“,auth=”-“,request=”/latency”,http_version=1.1,resp_bytes=3693i,client_ip=”10.10.10.10″ 1650309474000000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST auth=”-“,request=”/user/login”,resp_bytes=63i,client_ip=”10.10.10.10″,http_version=1.1,ident=”-” 1650309514000000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST ident=”-“,auth=”-“,request=”/user/login”,client_ip=”10.10.10.10″,resp_bytes=63i,http_version=1.1 1650309514001000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST resp_bytes=63i,client_ip=”10.10.10.10″,ident=”-“,auth=”-“,request=”/user/login”,http_version=1.1 1650309514002000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST request=”/user/login”,resp_bytes=63i,ident=”-“,auth=”-“,http_version=1.1,client_ip=”10.10.10.10″ 1650309514003000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST client_ip=”10.10.10.10″,auth=”-“,ident=”-“,request=”/user/login”,http_version=1.1,resp_bytes=63i 1650309514004000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST resp_bytes=63i,ident=”-“,request=”/user/login”,client_ip=”10.10.10.10″,auth=”-“,http_version=1.1 1650309514005000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=200,verb=GET ident=”-“,request=”/”,resp_bytes=1839i,auth=”-“,http_version=1.1,client_ip=”10.10.10.100″ 1650309517000000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=504,verb=POST request=”/qps”,auth=”-“,ident=”-“,http_version=1.1,resp_bytes=3693i,client_ip=”10.10.10.10″ 1650309524000000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=504,verb=POST resp_bytes=3693i,auth=”-“,request=”/latency”,http_version=1.1,client_ip=”10.10.10.10″,ident=”-” 1650309534000000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST http_version=1.1,resp_bytes=63i,auth=”-“,client_ip=”10.10.10.10″,ident=”-“,request=”/user/login” 1650309574000000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST ident=”-“,auth=”-“,resp_bytes=63i,client_ip=”10.10.10.10″,request=”/user/login”,http_version=1.1 1650309574001000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST ident=”-“,request=”/user/login”,auth=”-“,http_version=1.1,resp_bytes=63i,client_ip=”10.10.10.10″ 1650309574002000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST auth=”-“,request=”/user/login”,client_ip=”10.10.10.10″,ident=”-“,http_version=1.1,resp_bytes=63i 1650309574003000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST http_version=1.1,resp_bytes=63i,client_ip=”10.10.10.10″,auth=”-“,request=”/user/login”,ident=”-” 1650309514000000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST ident=”-“,auth=”-“,client_ip=”10.10.10.10″,request=”/user/login”,http_version=1.1,resp_bytes=63i 1650309514001000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST http_version=1.1,client_ip=”10.10.10.10″,request=”/user/login”,resp_bytes=63i,auth=”-“,ident=”-” 1650309514002000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST resp_bytes=63i,ident=”-“,request=”/user/login”,http_version=1.1,client_ip=”10.10.10.10″,auth=”-” 1650309514003000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST resp_bytes=63i,client_ip=”10.10.10.10″,ident=”-“,auth=”-“,request=”/user/login”,http_version=1.1 1650309574000000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST client_ip=”10.10.10.10″,ident=”-“,auth=”-“,resp_bytes=63i,request=”/user/login”,http_version=1.1 1650309574001000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST client_ip=”10.10.10.10″,resp_bytes=63i,ident=”-“,auth=”-“,request=”/user/login”,http_version=1.1 1650309574002000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST resp_bytes=63i,client_ip=”10.10.10.10″,ident=”-“,auth=”-“,request=”/user/login”,http_version=1.1 1650309574003000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST request=”/user/login”,resp_bytes=63i,client_ip=”10.10.10.10″,auth=”-“,http_version=1.1,ident=”-” 1650309514000000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST auth=”-“,http_version=1.1,resp_bytes=63i,client_ip=”10.10.10.10″,request=”/user/login”,ident=”-” 1650309514001000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST client_ip=”10.10.10.10″,auth=”-“,resp_bytes=63i,ident=”-“,request=”/user/login”,http_version=1.1 1650309514002000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST auth=”-“,resp_bytes=63i,request=”/user/login”,http_version=1.1,client_ip=”10.10.10.10″,ident=”-” 1650309514003000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST request=”/user/login”,resp_bytes=63i,client_ip=”10.10.10.10″,ident=”-“,http_version=1.1,auth=”-” 1650309514004000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST request=”/user/login”,client_ip=”10.10.10.10″,http_version=1.1,resp_bytes=63i,ident=”-“,auth=”-” 1650309514005000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST request=”/user/login”,http_version=1.1,resp_bytes=63i,client_ip=”10.10.10.10″,ident=”-“,auth=”-” 1650309514006000000nginx_access_log,host=enicMBP,path=/Users/enic/github/telegraf/testdata/access.log,resp_code=400,verb=POST ident=”-“,request=”/user/login”,resp_bytes=63i,client_ip=”10.10.10.10″,auth=”-“,http_version=1.1 1650309514007000000

                鄭重聲明:本文內(nèi)容及圖片均整理自互聯(lián)網(wǎng),不代表本站立場,版權(quán)歸原作者所有,如有侵權(quán)請聯(lián)系管理員(admin#wlmqw.com)刪除。
                用戶投稿
                上一篇 2022年6月25日 06:35
                下一篇 2022年6月25日 06:35

                相關(guān)推薦

                • cad連續(xù)標(biāo)注快捷鍵(cad連續(xù)標(biāo)注快捷鍵)

                  本文主要講的是cad連續(xù)標(biāo)注快捷鍵,以及和cad連續(xù)標(biāo)注快捷鍵相關(guān)的知識,如果覺得本文對您有所幫助,不要忘了將本文分享給朋友。 cad中連續(xù)標(biāo)注快捷鍵 CAD尺寸標(biāo)準(zhǔn)快捷命令:DL…

                  2022年11月27日
                • 泰拉瑞亞烏龜套(泰拉瑞亞烏龜套和神圣套哪個好)

                  今天小編給各位分享泰拉瑞亞烏龜套的知識,其中也會對泰拉瑞亞烏龜套和神圣套哪個好進(jìn)行解釋,如果能碰巧解決你現(xiàn)在面臨的問題,別忘了關(guān)注本站,現(xiàn)在開始吧! 泰拉瑞亞甲蟲套和烏龜套哪個好 …

                  2022年11月26日
                • 金素媛簽約We Entertainment公司 將展開演員活動

                  We Entertainment方面15日表示:”最近和金素媛簽訂了專屬合約。很高興能與金素媛一起邁出新的一步。” 還表示:”為了能讓金素媛作為…

                  2022年11月26日
                • 淘寶直播開通后帶貨鏈接怎么做(淘寶直播需要開通淘寶店鋪嗎)

                  直播帶貨無論是對于商家來說還是主播收益都是非??捎^的,所以不少平臺都有直播帶貨功能,一些小伙伴也想加入淘寶直播,那么淘寶直播開通后帶貨鏈接怎么做?下面小編為大家?guī)硖詫氈辈ラ_通后帶…

                  2022年11月24日
                • pdf虛擬打印機(jī)(添加pdf虛擬打印機(jī))

                  本文主要講的是pdf虛擬打印機(jī),以及和添加pdf虛擬打印機(jī)相關(guān)的知識,如果覺得本文對您有所幫助,不要忘了將本文分享給朋友。 pdf虛擬打印機(jī)具體是什么功能? 電腦虛擬打印機(jī)的功能有…

                  2022年11月24日
                • 今天武漢封控小區(qū)名單最新(武漢今天封控小區(qū)名單)

                  當(dāng)前許多省市的疫情持續(xù)不斷,個別地方的疫情更是有擴(kuò)散蔓延趨勢。據(jù)悉,近日武漢疫情波及范圍也越來越廣了 ,截至2022年11月23日9:00,武漢市有高低風(fēng)險地區(qū),在經(jīng)開區(qū)、黃陂區(qū)、…

                  2022年11月23日
                • 快手限流多久能解除(快手限流什么意思)

                  我相信很多人都看中了快手平臺的商機(jī),都爭先恐后地想要搶占機(jī)會,可一些人剛剛作出一點(diǎn)成績,就被降權(quán)了,自己也不知道什么原因。所以今天就來聊聊快手賬號降權(quán)操作分享,趕快來看看避免違規(guī)!…

                  2022年11月23日
                • Win11 22H2再出新問題Bug:無法彈出USB設(shè)備

                  作為Windows 11的首次大更新,在Win11 22H2發(fā)布后并沒有帶來預(yù)想的場景,各種問題頻現(xiàn)成為了一種常態(tài)。 近日有消息稱,Win11 22H2存在一個占用沖突Bug,當(dāng)用…

                  2022年11月22日
                • 美團(tuán)月付300小額取現(xiàn)?美團(tuán)月付取現(xiàn)300不見了

                  很多上班族每天都在使用美團(tuán)點(diǎn)外賣,你知道美團(tuán)現(xiàn)在推出了一款類似花唄的產(chǎn)品嗎?可以在美團(tuán)消費(fèi)的時候先消費(fèi)后還款,叫做美團(tuán)月付,是美團(tuán)推出的一款消費(fèi)型產(chǎn)品,不能直接提現(xiàn)到銀行卡,只能用…

                  2022年11月21日
                • 劉愷威承認(rèn)與李曉峰戀情!甜蜜分享相處日常,病榻中獲其照顧

                  沒想到劉愷威的“第二春”來得這么突然,但進(jìn)展卻非常迅速,由最開始的認(rèn)錯人,到中途逛寺廟,再到女主變相承認(rèn),兩人牽手做核酸等等,這個過程也就一個多月的時間。 11月18號晚,劉愷威在…

                  2022年11月20日

                聯(lián)系我們

                聯(lián)系郵箱:admin#wlmqw.com
                工作時間:周一至周五,10:30-18:30,節(jié)假日休息