Syslog and Log files.ppt
《Syslog and Log files.ppt》由会员分享,可在线阅读,更多相关《Syslog and Log files.ppt(39页珍藏版)》请在麦多课文档分享上搜索。
1、Syslog and Log files,Haiying BaoJune 15, 1999,Outline,Log files What need to be logged Logging policies Finding log files Syslog: the system event logger how syslog works its configuration file the software that uses syslog debugging syslog,What to be logged?,The accounting system The kernel Various
2、 utilities all produce data that need to be logged most of the data has a limited useful lifetime, and needs to be summarized, compressed, archived and eventually thrown away,Logging policies,Throw away all data immediately Reset log files at periodic intervals Rotate log files, keeping data for a f
3、ixed time Compress and archive to tape or other permanent media,Which one to choose,Depends on : how much disk space you have how security-conscious you are Whatever scheme you select, regular maintenance of log files should be automated using cron (chap 10, periodic process),Throwing away log files
4、,not recommend security problems ( accounting data and log files provide important evidence of break-ins) helpful for alerting you to hardware and software problems. In general, keep one or two months in a real world, it may take one or two weeks for SA to realize that site has been compromised by a
5、 hacker and need to review the logs,Throwing away (cont.),Most sites store each days log info on disk, sometimes in a compressed format These daily files are kept for a specific period of time and then deleted One common way to implement this policy is called “rotation”,Rotating log files,Keep backu
6、p files that are one day old, two days old, and so on. logfile, logfile.1 , logfile.2, logfile.7Each day rename the files to push older data toward the end of the chain script to archive three days files,#! /bin/sh cd /var/log mv logfile.2 logfile.3 mv logfile.1 logfile.2 mv logfile logfile.1 cat /d
7、ev/null logfile,Some daemons keep their log files open all the time, this script cant be used with them. To install a new log file, you must either signal the daemon, or kill and restart it.,#! /bin/sh cd /var/log mv logfile.2.Z logfile.3.Z mv logfile.1.Z logfile.2.Z mv logfile logfile.1 cat /dev/nu
8、ll logfile kill -signal pid compress logfile.1,signal - appropriate signal for the program writing the log file pid - process id,Archiving log files,Some sites must archive all accounting data and log files as a matter of policy, to provide data for a potential audit Log files should be first rotate
9、 on disk, then written to tape or other permanent media see chap 11, Backups,Finding log files,To locate log files, read the system startup scripts : /etc/rc* or /etc/init.d/* if logging is turned on when daemons are run where messages are sent Some programs handle logging via syslog check /etc/sysl
10、og.conf to find out where this data goes,Finding log files,Different operating systems put log files in different places: /var/log/* /var/cron/log /usr/adm /var/adm On linux, all the log files are in /var/log directory.,Outline,Log files What need to be logged Logging policies Finding log files Sysl
11、og: the system event logger how syslog works its configuration file debugging syslog the software that uses syslog,What is syslog,A comprehensive logging system, used to manage information generated by the kernel and system utilities. Allow messages to be sorted by their sources and importance, and
12、routed to a variety of destinations: log files, users terminals, or even other machines.,Syslog: three parts,Syslogd and /etc/syslog.conf the daemon that does the actual logging its configuration file openlog, syslog, closelog library routines that programs use to send data to syslogd logger user-le
13、vel command for submitting log entries,syslog-aware programs,Using syslog lib. Routines write log entries to a special file,/dev/log,syslogd,/etc/syslog.conf,reads,consults,dispatches,Log files,Userss terminals,Other machines,/dev/klog,Configuring syslogd,The configuration file /etc/syslog.conf cont
14、rols syslogds behavior. It is a text file with simple format, blank lines and lines beginning with # are ignored. Selector action eg. mail.info /var/log/maillog,Configuration file selector,Identify source - the program (facility) that is sending a log message importance - the messagess severity leve
15、l eg. mail.info /var/log/maillog Syntax facility.level facility names and severity levels must chosen from a list of defined values,Configuration file Facility names,Facility Programs that use it kern the kernel user User process, default if not specified mail The mail system daemon System daemons a
16、uth Security and authorization related commands lpr the BSD line printer spooling system news The Usenet news system,Configuration file Facility names,Facility Programs that use it uucp Reserved for UUCP cron the cron daemon mark Timestamps generated at regular intervals local0-7 Eight flavors of lo
17、cal message syslog syslog internal messages authpriv Private or system authorization messages ftp the ftp daemon, ftpd * All facilities except “mark”,Configuration file Facility names,Timestamps can be used to log time at regular intervals (by default, every 20 minutes), so you can figure out that y
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- SYSLOGANDLOGFILESPPT
