AIX系統日誌學習筆記之二

來源:互聯網
上載者:User

  AIX有一個特殊的系統守護進程,syslogd,用於記錄系統資訊,設定檔在/etc/syslog.conf.這個檔案描述syslogd守護進程發送資訊時的目的地、啟用事件等。
還有一個/etc/syslog.pid檔案與syslog.conf配合,syslog.pid只有一行內容,syslogd守護進程的進程ID,可以用來終止或者配置日誌守護進程。
我們可以定製/etc/syslog.conf檔案,可以定義系統資訊的目的地,反映機制等
 
#cat /etc/syslog.conf
# @(#)34        1.11.2.1  src/bos/etc/syslog/syslog.conf, cmdnet,bos61N, n2011_13B1 2/21/11 04:02:04
#IBM_PROLOG_BEGIN_TAG
# This is anautomatically generated prolog.
#
# bos61Nsrc/bos/etc/syslog/syslog.conf 1.11.2.1
#
# LicensedMaterials - Property of IBM
#
# COPYRIGHTInternational Business Machines Corp. 1988,1989
# All RightsReserved
#
# US GovernmentUsers Restricted Rights - Use, duplication or
# disclosurerestricted by GSA ADP Schedule Contract with IBM Corp.
#
#IBM_PROLOG_END_TAG
#
#COMPONENT_NAME: (CMDNET) Network commands.
#
# FUNCTIONS:
#
# ORIGINS: 27
#
# (C) COPYRIGHTInternational Business Machines Corp. 1988, 1989
# All RightsReserved
# LicensedMaterials - Property of IBM
#
# US GovernmentUsers Restricted Rights - Use, duplication or
# disclosurerestricted by GSA ADP Schedule Contract with IBM Corp.
#
#/etc/syslog.conf - control output of syslogd
#
#
# Each line mustconsist of two parts:-
#
# 1) A selectorto determine the message priorities to which the
#    line applies
# 2) An action.
#
# Each line cancontain an optional part:-
#
# 3) Rotation.
#
# The fieldsmust be separated by one or more tabs or spaces.
#
# format:
#
#<msg_src_list> <destination> [rotate [size <size> k|m] [files<files>] [time <time> h|d|w|m|y] [compress] [archive<archive>]]
#
# where<msg_src_list> is a semicolon separated list of<facility>.<priority>
# where:
#
#<facility> is:
#       * - all (except mark)
#       mark - time marks
功能可選項
#       kern,user,mail,daemon, auth,... (seesyslogd(AIX Commands Reference))
#
#<priority> is one of (from high to low):
錯誤優先順序
#       emerg/panic,alert,crit,err(or),warn(ing),notice,info,debug
#       (meaning all messages of this priority orhigher)
#
#<destination> is:
#       /filename - log to this file
#       username[,username2...] - write touser(s)
#       @hostname - send to syslogd on thismachine
#       * - send to all logged in users
#
# [rotate [size<size> k|m] [files <files>] [time <time> h|d|w|m|y][compress] [archive <archive>]] is:
#       If <destination> is a regular fileand the word "rotate" is
#       specified, then the <destination>is limited by either
#       <size> or <time>, or both<size> and <time>. The <size> causes
#       the <destination> to be limited to<size>, with <files> files
#       kept in the rotation. The <time>causes the <destination> to be rotated after
#       <time>. If both <time> and<size> are specified then logfiles
#       will be rotated once the the logfilesize exceeds the <size>
#       or after <time>, whichever isearlier. The rotated filenames
#       are created by appending a period and anumber to <destination>,
#       starting with ".0".
#
#       If compress option is specified then thelogfile names will be
#       generated with a ".Z"extension. The files keyword will be applicable
#       to the logfiles which are currentlyunder rotation. For example
#       if we specify the compress option thenonly fileis with ".Z" extension
#       will be under rotation and number ofsuch files will be limited by
#       <files> files. Any logfiles withan extension other than ".Z"
#       will not be under the rotation schemeand thus will not be within
#       the limit of <files> files.Similarly if we remove the compress
#       option then the files which have beengenerated with ".Z" extension
#       will no longer be the part of rotationscheme and will not be limited
#       by the <files> files.
#
#       The minimum size that can be specifiedis 10k, the minimum
#       number of files that can be specified is2. The default
#       size is 1m (meg) and the default for<files> is unlimited.
#       Therefore, if only "rotate" isspecified, the log will be
#       rotated with <size> = 1m.
#       The compress option means that rotatedlog files that are not
#       in use will be compressed.
#       The archive option will save rotated logfiles that are not
#       in use to <archive>.
#       The default is not to rotate log files.
#
# example:
# "mailmessages, at debug or higher, go to Log file. File must exist."
# "allfacilities, at debug and higher, go to console"
# "allfacilities, at crit or higher, go to all users"
#  mail.debug           /usr/spool/mqueue/syslog
#  *.debug              /dev/console
#  *.crit                       *
#  *.debug              /var/log/syslog.out     rotate size 100k files 4
#  *.crit               /var/log/syslog.out     rotate time 1d
 
*.info /var/adm/ras/syslog.caarotate size 1m files 10
 
 
/etc/syslog.conf可以定製系統日誌的產生和輸出,編輯之後需要重啟syslogd,才會生效。
下面是一些基本啟動和關閉的命令:
#
# lssrc -s syslogd
Subsystem         Group            PID          Status
 syslogd          ras              5177376      active
# cat /etc/syslog.pid
5177376
# ps -ef | grep syslogd
    root 5177376  2162834   0  Feb 01      -  0:04 /usr/sbin/syslogd
    root 5898452  5767218   0 10:49:35 pts/1  0:00 grep syslogd
# stopsrc -s syslogd
0513-044 Thesyslogd Subsystem was requested to stop.
# ps -ef | grep syslogd
    root 5898454  5767218   0 10:50:01 pts/1  0:00 grep syslogd
# startsrc -s syslogd
0513-059 Thesyslogd Subsystem has been started. Subsystem PID is 5898456.
# ps -ef | grep syslogd
    root 5898456  2162834   0 10:50:09      - 0:00 /usr/sbin/syslogd
    root 7209178  5767218   0 10:50:20 pts/1  0:00 grep syslogd
#
定製執行個體:www.2cto.com
1 、將調試級或以上的所有郵件功能訊息記錄到檔案/tmp/mailsyslog,可以輸入以下命令:
 
      mail.debug /tmp/mailsyslog
          其中:
          mail 是功能。
          debug 是優先順序。
          /tmp/mailsyslog 是目標。
2、將除來自郵件功能以外的所有系統訊息發送到名為rigil 的主機(此處可以直接使用IP地址),可以輸入以下命令:
      *.debug;mail.none @rigil
          其中:
          * 和mail 是功能。
          debug 和none 是優先順序。
          @rigil 是目標。
3、將來自所有功能的emerg 優先順序的訊息和來自郵件及守護進程的crit 及以上優先順序的訊息發送到使用者nick 和jam,可以輸入以下命令:
      *.emerg;mail,daemon.crit nick, jam
          其中:
          *、mail 和daemon 是功能。
          emerg 和crit 是優先順序。
          nick 和jam 是目標。
4、將所有郵件功能訊息發送到所有使用者的終端螢幕,可以輸入以下命令:
    mail.debug *
          其中:
          mail 是功能。
          debug 是優先順序。
          * 是目標。
 

摘自 wolf

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.