尊龙凯时人生就是搏

Linux ЧÀÍÆ÷´ó×ÚµÄ log ÈÕÖ¾£¬ÔõÑù׼ȷ¿´ÈÕÖ¾¿ìËÙ¶¨Î»¹ýʧ£¿

Õë¶Ô´ó×ÚlogÈÕÖ¾¿ìËÙ¶¨Î»¹ýʧµØ·½

¶¯Ì¬Éó²éÈÕÖ¾

tail -f catalina.out

µÇ¼ºó¸´ÖÆ

ÖØз­¿ªÈÕÖ¾Îļþ

cat catalina.out

µÇ¼ºó¸´ÖÆ

¿ÉÒÔʹÓà >nanjiangtest.txt Êä³öij¸öÐÂÈÕ־ȥÉó²é

[root@yesky logs]# cat -n catalina.out |grep 717892466 >nanjiangtest.txt

µÇ¼ºó¸´ÖÆ

tail/head¼òÆÓÏÂÁîʹÓãº

[root@yesky logs]# tail -n number catalina.out ÅÌÎÊÈÕ־β²¿×îºónumberÐеÄÈÕÖ¾[root@yesky logs]# tail -n +number catalina.out ÅÌÎÊnumberÐÐÖ®ºóµÄËùÓÐÈÕÖ¾[root@yesky logs]# head -n number catalina.out ÅÌÎÊÈÕÖ¾ÎļþÖеÄÇ°numberÐÐÈÕÖ¾[root@yesky logs]# head -n -number catalina.out ÅÌÎÊÈÕÖ¾Îļþ³ýÁË×îºónumberÐеÄÆäËûËùÓÐÈÕÖ¾

µÇ¼ºó¸´ÖÆ

µÚÒ»ÖÖ·½·¨£¨Æ¾Ö¤Òªº¦×Ö²éÕÒ³öÐкţ©£º

Óà grep Äõ½µÄÈÕÖ¾ºÜÉÙ£¬ÎÒÃÇÐèÒªÉó²éÖÜΧµÄÈÕÖ¾¡£ÎÒÊÇÕâÑù×öµÄ£¬Ê×ÏÈ: cat -n test.log | grep ¡°Òªº¦´Ê¡± »ñµÃÒªº¦ÈÕÖ¾µÄÐкÅ

[root@yesky logs]# cat -n catalina.out |grep 71789246613230539        [11:07 17:47:11] INFO nanjiang:Edit Old Article£º717892466-2020-11-07 17:47:1113230593        [11:07 17:47:15] INFO nanjiangSave Article ID IS£º71789246613230595        717892466 article.getDisplayTime()1 = 2020-11-07 16:25:1113230596        717892466 article.getDisplayTime()2 = 2020-11-07 16:25:1113230601        [11:07 17:47:15] INFO ÄϽ­ 10.10.10.39  edit    article 717892466       ±à¼­ÎÄÕÂ

µÇ¼ºó¸´ÖÆ

cat -n catalina.out|tail -n +13230539|head -n 10

tail -n +13230539ÌåÏÖÅÌÎÊ13230539ÐÐÖ®ºóµÄÈÕÖ¾

head -n 10 ÔòÌåÏÖÔÚÇ°ÃæµÄÅÌÎÊЧ¹ûÀïÔÙ²éÇ°10Ìõ¼Í¼

[root@yesky logs]# cat -n catalina.out |tail -n +13230539|head -n 1013230539        [11:07 17:47:11] INFO nanjiang:Edit Old Article£º717892466-2020-11-07 17:47:1113230540        [11:07 17:47:11] INFO Takes:2 ms class com.tmg.cms.manager.dao.article.impl.ArticleContentDaoImpl       getListByArticleId      [NzE3ODkyNDY2]       [int]13230541        [11:07 17:47:11] INFO Takes:1 ms class com.tmg.cms.manager.dao.resourceImage.impl.ResourceImageDaoImpl  load    13230542        [11:07 17:47:11] INFO Takes:0 ms class com.tmg.cms.manager.dao.resourceImage.impl.ResourceImageDaoImpl  load    13230543        [11:07 17:47:11] INFO Takes:1 ms class com.tmg.cms.manager.dao.resourceImage.impl.ResourceImageDaoImpl  load    13230544        [11:07 17:47:11] INFO article.getImage3£º/uploadImages/2020/312/02/3NXCRK4U3589_2.jpg13230545        [11:07 17:47:11] INFO Takes:0 ms class com.tmg.cms.manager.dao.resourceImage.impl.ResourceImageDaoImpl  load   13230546        [11:07 17:47:11] INFO Takes:2 ms class com.tmg.cms.manager.dao.privilege.impl.UserDaoImpl       getUserByid     13230547        [11:07 17:47:11] INFO Takes:57 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl     selectSitemapWithoutAudit       [MQ==]  [int]13230548        [11:07 17:47:11] INFO Takes:5 ms class com.tmg.cms.manager.dao.forbidword.impl.ForbidwordDaoImpl        getForbidwordBysiteid   [MjI=]  [int]

µÇ¼ºó¸´ÖÆ

µÚ¶þÖÖ·½·¨£ºÉó²éָ׼ʱ¼ä¶ÎÄÚµÄÈÕÖ¾

Ê×ÏÈÒª¾ÙÐйæģʱ¼ä¶ÎÄÚÈÕÖ¾ÅÌÎÊÏÈÉó²éÊÇ·ñÔÚÄ¿½ñÈÕÖ®ÄÚ±£´æ

grep '11:07 18:29:20' catalina.outgrep '11:07 18:31:11' catalina.out

µÇ¼ºó¸´ÖÆ

ʱ¼ä¹æÄ£ÄÚµÄÅÌÎÊ

sed -n '/11:07 18:29:20/,/11:07 18:31:11/p' catalina.out sed -n '/11:07 18:29:/,/11:07 18:31:/p' catalina.out

µÇ¼ºó¸´ÖÆ

µÚÈýÖÖ·½·¨£ºÉó²éÈÕÖ¾ÖÐÌض¨×Ö·ûµÄÆ¥ÅäÊýÄ¿

[root@yesky logs]# grep '1175109632' catalina.out | wc -l154

µÇ¼ºó¸´ÖÆ

µÚËÄÖÖ·½·¨£ºÅÌÎÊ×îºónumberÐУ¬²¢²éÕÒÒªº¦×Ö¡°Ð§¹û¡±

[root@yesky logs]# tail -n 20 catalina.out | grep 'INFO Takes:1'[11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.config.impl.ConfigInfoDaoImpl    load    [11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [NTkwOTQ5]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzI0]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzI3]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzMw]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzA5NA==]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [Mzc4Mg==]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [OTM1MA==]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MTE5MDMw]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [NTQ2MzQw]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [NTg2NzYy]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzYyMjA=]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.configModule.impl.ConfigModuleDaoImpl    getPersonMenuList

µÇ¼ºó¸´ÖÆ

µÚÎåÖÖ·½·¨£ºÅÌÎÊ×îºónumberÐУ¬²¢²éÕÒÒªº¦×Ö¡°Ð§¹û¡±²¢ÇÒ¶ÔЧ¹û¾ÙÐбêºì

[root@yesky logs]# tail -n 20 catalina.out | grep 'INFO Takes:1' --color[11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.config.impl.ConfigInfoDaoImpl    load    [11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [NTkwOTQ5]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzI0]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzI3]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzMw]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzA5NA==]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [Mzc4Mg==]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [OTM1MA==]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MTE5MDMw]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [NTQ2MzQw]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [NTg2NzYy]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzYyMjA=]  [int]

µÇ¼ºó¸´ÖÆ

µÚÁùÖÖ·½·¨£ºÅÌÎÊ×îºónumberÐУ¬²¢²éÕÒÒªº¦×Ö¡°Ð§¹û¡±²¢ÇÒ¶ÔЧ¹û¾ÙÐбêºì£¬ÉÏÏÂÀ©Õ¹Á½ÐÐ

[root@yesky logs]# tail -n 20 catalina.out | grep 'INFO Takes:1' --color -a2[11:11 22:02:51] INFO Takes:0 ms class com.tmg.cms.manager.dao.article.impl.ArticleContentDaoImpl    getArticlePageNum   [NzE4MTM2ODky]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.config.impl.ConfigInfoDaoImpl    load    [com.tmg.cms.manager.model.config.ConfigInfo][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [NTkwOTQ5]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzI0]  [int][11:11 22:02:51] INFO Takes:0 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzI1]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzI3]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzMw]  [int][11:11 22:02:51] INFO Takes:0 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzAzNg==]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzA5NA==]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [Mzc4Mg==]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [OTM1MA==]  [int][11:11 22:02:51] INFO Takes:0 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MTE0MjQ4]  [int][11:11 22:02:51] INFO Takes:0 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MTE4MDc4]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MTE5MDMw]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [NTQ2MzQw]  [int][11:11 22:02:51] INFO Takes:0 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [NTQ3MTIw]  [int][11:11 22:02:51] INFO Takes:0 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [NTY4OTYx]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [NTg2NzYy]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.sitemap.impl.SitemapDaoImpl    getSitemapTop   [MzYyMjA=]  [int][11:11 22:02:51] INFO Takes:1 ms class com.tmg.cms.manager.dao.configModule.impl.ConfigModuleDaoImpl    getPersonMenuList   [com.tmg.cms.manager.model.config.ConfigPersonMenu]

µÇ¼ºó¸´ÖÆ

µÚÆßÖÖ·½·¨£º·ÖÒ³Éó²é£¬Ê¹Óÿոñ·­Ò³(ʹÓÃmore/less)

[root@yesky logs]# tail -n 2000 catalina.out | grep 'INFO Takes:1' --color -a2 | more[root@yesky logs]# tail -n 2000 catalina.out | grep 'INFO Takes:1' --color -a2 | less

µÇ¼ºó¸´ÖÆ

¸½¼Ó£º

È«ÆÁµ¼º½

ctrl + F – ÏòÇ°Òƶ¯Ò»ÆÁ

ctrl + B – ÏòºóÒƶ¯Ò»ÆÁ

ctrl + D – ÏòÇ°Òƶ¯°ëÆÁ

ctrl + U – ÏòºóÒƶ¯°ëÆÁ

µ¥Ðе¼º½

j – ÏòÇ°Òƶ¯Ò»ÐÐ

k – ÏòºóÒƶ¯Ò»ÐÐ

ÆäËüµ¼º½

G – Òƶ¯µ½×îºóÒ»ÐÐ

g – Òƶ¯µ½µÚÒ»ÐÐ

q / ZZ – Í˳ö less ÏÂÁî

ÒÔÉϾÍÊÇLinux ЧÀÍÆ÷´ó×ÚµÄ log ÈÕÖ¾£¬ÔõÑù׼ȷ¿´ÈÕÖ¾¿ìËÙ¶¨Î»¹ýʧ£¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ