php – Rsyslog重复日志(rsyslog.conf和rsyslog.d / something.conf)

前端之家收集整理的这篇文章主要介绍了php – Rsyslog重复日志(rsyslog.conf和rsyslog.d / something.conf)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我使用local0创建了一个自定义日志( PHP将日志条目发送到rsyslog).它使用新的自定义文件(/var/log/sea.log).问题是日志被发送到/var/log/sea.log,/ var / log / messages和/ var / log / syslog.我该如何防止这种情况发生?我只需要将日志发送到/var/log/sea.log.

/etc/rsyslog.conf:

  1. # /etc/rsyslog.conf Configuration file for rsyslog.
  2. #
  3. # For more information see
  4. # /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
  5.  
  6.  
  7. #################
  8. #### MODULES ####
  9. #################
  10.  
  11. $ModLoad imuxsock # provides support for local system logging
  12. $ModLoad imklog # provides kernel logging support
  13. #$ModLoad immark # provides --MARK-- message capability
  14.  
  15. # provides UDP syslog reception
  16. #$ModLoad imudp
  17. #$UDPServerRun 514
  18.  
  19. # provides TCP syslog reception
  20. #$ModLoad imtcp
  21. #$InputTCPServerRun 514
  22.  
  23.  
  24. ###########################
  25. #### GLOBAL DIRECTIVES ####
  26. ###########################
  27.  
  28. #
  29. # Use traditional timestamp format.
  30. # To enable high precision timestamps,comment out the following line.
  31. #
  32. $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
  33.  
  34. #
  35. # Set the default permissions for all log files.
  36. #
  37. $FileOwner root
  38. $FileGroup adm
  39. $FileCreateMode 0640
  40. $DirCreateMode 0755
  41. $Umask 0022
  42.  
  43. #
  44. # Where to place spool and state files
  45. #
  46. $WorkDirectory /var/spool/rsyslog
  47.  
  48. #
  49. # Include all config files in /etc/rsyslog.d/
  50. #
  51. $IncludeConfig /etc/rsyslog.d/*.conf
  52.  
  53.  
  54. ###############
  55. #### RULES ####
  56. ###############
  57.  
  58. #
  59. # First some standard log files. Log by facility.
  60. #
  61. auth,authpriv.* /var/log/auth.log
  62. *.*;auth,authpriv.none -/var/log/syslog
  63. #cron.* /var/log/cron.log
  64. daemon.* -/var/log/daemon.log
  65. kern.* -/var/log/kern.log
  66. lpr.* -/var/log/lpr.log
  67. mail.* -/var/log/mail.log
  68. user.* -/var/log/user.log
  69.  
  70. #
  71. # Logging for the mail system. Split it up so that
  72. # it is easy to write scripts to parse these files.
  73. #
  74. mail.info -/var/log/mail.info
  75. mail.warn -/var/log/mail.warn
  76. mail.err /var/log/mail.err
  77.  
  78. #
  79. # Logging for INN news system.
  80. #
  81. news.crit /var/log/news/news.crit
  82. news.err /var/log/news/news.err
  83. news.notice -/var/log/news/news.notice
  84.  
  85. #
  86. # Some "catch-all" log files.
  87. #
  88. *.=debug;\
  89. auth,authpriv.none;\
  90. news.none;mail.none -/var/log/debug
  91. *.=info;*.=notice;*.=warn;\
  92. auth,authpriv.none;\
  93. cron,daemon.none;\
  94. mail,news.none -/var/log/messages
  95.  
  96. #
  97. # Emergencies are sent to everybody logged in.
  98. #
  99. *.emerg :omusrmsg:*
  100.  
  101. #
  102. # I like to have messages displayed on the console,but only on a virtual
  103. # console I usually leave idle.
  104. #
  105. #daemon,mail.*;\
  106. # news.=crit;news.=err;news.=notice;\
  107. # *.=debug;*.=info;\
  108. # *.=notice;*.=warn /dev/tty8
  109.  
  110. # The named pipe /dev/xconsole is for the `xconsole' utility. To use it,# you must invoke `xconsole' with the `-file' option:
  111. #
  112. # $xconsole -file /dev/xconsole [...]
  113. #
  114. # NOTE: adjust the list below,or you'll go crazy if you have a reasonably
  115. # busy site..
  116. #
  117. daemon.*;mail.*;\
  118. news.err;\
  119. *.=debug;*.=info;\
  120. *.=notice;*.=warn |/dev/xconsole

/etc/rsyslog.d/sea.conf:

  1. local0.info /var/log/sea.log
  2. local0.none /var/log/messages
  3. local0.none /var/log/syslog
您还可以在语句后使用“final”选项.更容易.
  1. local.0 /var/log/sea.log
  2. &~

猜你在找的PHP相关文章