首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Logwatch警告引用的日志文件行(UbuntuServer18.04)

Logwatch警告引用的日志文件行(UbuntuServer18.04)
EN

Ask Ubuntu用户
提问于 2020-09-27 15:30:59
回答 1查看 126关注 0票数 0

如何在日志文件中找到Ubuntu引用的特定行,如下面标记的行.在Amavis和postfix内部?

按日期计算,我可以grep所有"warning"或任何其他单词的实例(我一直在这么做),但是必须有更好的方法来识别那些特定的行,而不需要猜测。

是否有办法使Watchlog日志文件从警告或状态日志行号下面的实际系统日志文件中引用准确的行?

如何消化您的Logwatch日志文件?

**text of the actual line**标记了这些行,似乎在代码块中,现在有方法可以转换Bold (至少我找不到)

代码语言:javascript
复制
################### Logwatch 7.4.3 (12/07/16) #################### 
        Processing Initiated: Tue Sep 22 06:25:23 2020
        Date Range Processed: yesterday
                              ( 2020-Sep-21 )
                              Period is day.
        Detail Level of Output: 0
        Type of Output/Format: mail / text
        Logfiles for Host: mail
 ################################################################## 
 
 --------------------- Amavisd-new Begin ------------------------ 

      **1   *Warning: Security risk**
      **4   Miscellaneous warnings**
 
        9   Total messages scanned ------------------  100.00%
  212.600K  Total bytes scanned                        217,702
    ...
 
 ---------------------- Amavisd-new End ------------------------- 
    ...
 --------------------- Postfix Begin ------------------------ 

        2   SASL authentication failed                       2
      **1   Miscellaneous warnings                           1**
 
  363.644K  Bytes accepted                             372,371
    ...
 
 ---------------------- Postfix End ------------------------- 
 
 ###################### Logwatch End ######################### 
EN

回答 1

Ask Ubuntu用户

发布于 2020-09-30 16:42:23

这个问题的解决方案,我发现,做得更少,我想要的,引用日志线在LogWatch日志下的警告。

它是通过简单地(谁会想到:)将Detail Level of Output提升到5来实现的,就像您在头文件中看到的那样。这就产生了一个Summary和一个Detail节。Detail部分引用原始日志文本,以防出现警告,或澄清其内容。

通过这种方式,Tha Logwatch日志获得的时间要长得多,但我宁愿容忍这种情况,因为我可以看到所需的信息,而不必挖掘原始日志文件。在此基础上,如果需要减少日志长度,则可以抑制兴趣较小的部分。

代码语言:javascript
复制
 ################### Logwatch 7.4.3 (12/07/16) #################### 
        Processing Initiated: Wed Sep 30 15:47:17 2020
        Date Range Processed: 2020/09/21
                              ( 2020-Sep-21 )
                              Period is day.
        Detail Level of Output: 5
        Type of Output/Format: mail / text
        Logfiles for Host: mail
 ################################################################## 
 --------------------- Amavisd-new Begin ------------------------ 

 ****** Summary *************************************************************************************
 
        1   *Warning: Security risk
        4   Miscellaneous warnings 
 
        9   Total messages scanned ------------------  100.00%
  212.600K  Total bytes scanned                        217,702
 ========   ==================================================
 
        9   Passed ----------------------------------  100.00%
        9     Clean passed                             100.00%
...
 
 ****** Detail (10) *********************************************************************************
 
        1   *Warning: Security risk -----------------------------------------------------------------
        1      Open relay? Nonlocal recips but not originating: user@domain.com
 
        4   Miscellaneous warnings ------------------------------------------------------------------
        4      Use of uninitialized value in subroutine entry
 
       47   SMTP response 

...
 
======================================================================================================

 ---------------------- Amavisd-new End ------------------------- 

...
 
 --------------------- Postfix Begin ------------------------ 

 ****** Summary *************************************************************************************
 
        2   SASL authentication failed                       2
        1   Miscellaneous warnings                           1
 
  363.644K  Bytes accepted                             372,371
  277.836K  Bytes sent via SMTP                        284,504
  150.715K  Bytes sent via LMTP                        154,332
 ========   ==================================================
 
       17   Accepted                                    94.44%
        1   Rejected                                     5.56%
 --------   --------------------------------------------------
       18   Total                                      100.00%
 ...
 
 ****** Detail (10) *********************************************************************************
 
        2   SASL authentication failed --------------------------------------------------------------
        2      Login: ************
 
        1   Miscellaneous warnings ------------------------------------------------------------------
        1      hostname zg-0915b-242.stretchoid.com does not resolve to address 192.241.239.36: Na...
 
        1   5xx Reject relay denied -----------------------------------------------------------------
        1      77.43.80.224     net77-43-80-224.mclink.it
 
       45   Connections lost (inbound)
...

============================================================================================
票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1278153

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档