mysql 慢日誌 截取時間段

來源:互聯網
上載者:User

標籤:日誌資訊   query   資料   nbsp   定時   mys   awk   bsp   查看   

執行mysqldumpslow –h可以查看協助資訊。主要介紹兩個參數-s和-t
-s 這個是排序參數,可選的有:
al: 平均鎖定時間
ar: 平均返回記錄數
at: 平均查詢時間
c: 計數
l: 鎖定時間
r: 返回記錄
t: 查詢時間
-t n 顯示頭n條記錄
###########################
通常需要查看某個時間段的日誌資訊:

 

 awk ‘/# Time: 2017-10-30T20/,/# Time: 2017-10-31T03/‘  query-slow.log_42_20171031 > /tmp/a_log

 

awk ‘/# Time: ‘110223‘/,/# Time: ‘110224‘/‘ slow.log 取出一天的資料

awk ‘/# Time: ‘110303‘ ‘1‘/,/# Time: ‘110303‘ ‘2‘/‘ slow.log 取出3號一點到2點之間的資料

awk ‘/# Time: ‘110303‘ ‘1‘/,/# Time: ‘110303‘ ‘a‘/‘ slow.log 可以取出1點以後的所有資料

awk ‘/# Time: ‘140701‘/,/# Time: ‘140703‘/‘ slow.log

 

awk ‘/# Time: ‘140703‘ ‘9‘/,/# Time: ‘110303‘ ‘a‘/‘

mysql 慢日誌 截取時間段

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.