Chapter 11 Syslog and Log Rotate. Computer Center, CS, NCTU 2 Log files  Execution information of each services sshd log files httpd log files ftpd log.

Slides:



Advertisements
Similar presentations
CIS Lesson 12 System Monitoring 1. CIS Lesson 12 System Monitoring Monitoring Log Files /var/log ‒ Can be used as indication of systematic.
Advertisements

Syslog and log files1-1 Syslog and Log Files  From logfiles, you can find m important information m History m Errors/warnings  Logging policies m Reset.
Xinwen Fu Linux Logging Mechanisms Computer & Network Forensics.
Detecting Intruders from log files and traces Special Intruder Detection Systems (IDS) are now a market niche, and there are many products on the market.
CIS 193A – Lesson3 Vigilance! Logging & Monitoring Syslog Logrotate Logwatch Accounting.
Chapter 21 Security. Computer Center, CS, NCTU 2 Firewall (1)  Using ipfw 1.Add these options in kernel configuration file and recompile the kernel 2.Edit.
Chapter 3 Rootly Powers. Computer Center, CS, NCTU 2 The Root  Root Root is God, also called super-user. UID is 0  UNIX permits the superuser to perform.
Syslogd Tracking system events. Log servers Applications are constantly encountering events which should be recorded –users attempt to login with bad.
Daemon Processes and inetd Superserver
Chapter 9 Periodic Processes. Computer Center, CS, NCTU 2 CRON – Schedule Commands (1)  What we want? Do things at right time automatically  cron daemon.
Information Networking Security and Assurance Lab National Chung Cheng University Investigating Unix System.
Linux+ Guide to Linux Certification, Second Edition
Chapter 3 Unix Overview. Figure 3.1 Unix file system.
Syslog and Log files Haiying Bao June 15, Outline Log files –What need to be logged –Logging policies –Finding log files Syslog: the system event.
CIT 470: Advanced Network and System AdministrationSlide #1 CIT 470: Advanced Network and System Administration Logging.
NOC TOOLS syslog AfNOG Cairo, SI-E, 2 of 5 Sunday Folayan.
AfChix 2011 Blantyre, Malawi Log management. Log management and monitoring ■ What is log management and monitoring ? ● It's about keeping your logs in.
Services, logging, accounting Todd Kelley CST8177– Todd Kelley1.
Syslog and log files Ameera Jaradat.
System Monitoring and Automation CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.
ITI-481: Unix Administration Meeting 5. Today’s Agenda Network Information Service (NIS) The Cron Program Syslogd and Logging.
7 November 2005 Sebastian Büttrich ItrainOnline MMTK 1 Linux logging and logfiles monitoring with swatch Sebastian Büttrich, wire.less.dk.
SCSC 455 Computer Security Chapter 4 File Security.
CIS 450 – Network Security Chapter 16 – Covering the Tracks.
System logging and monitoring
System Administration System Configuration and Logs.
System Monitoring and Automation. 2 Section Overview Automation of Periodic Tasks Scheduling and Cron Syslog Accounting.
TELE 301 Lecture 10: Scheduled … 1 Overview Last Lecture –Post installation This Lecture –Scheduled tasks and log management Next Lecture –DNS –Readings:
Day 11 SAMBA NFS Logs Managing Users. SAMBA Implements the ability for a Linux machine to communicate with and act like a Windows file server. –Implements.
Syslog and Log Rotate. Computer Center, CS, NCTU 2 Log 是啥 ?  “System error!!... Plz. Help!!  “System crash!! Blabla..”  “System unstable!!...”  “user.
Backups, Logging, Troubleshooting. Dates for Last Week of Class Homework 7 – Due Tuesday 5/1 by midnight Labs 7 & 8 – 8 is extra credit – Due Thursday.
CIS 290 LINUX Security Tripwire file integrity and change management tool and log monitoring.
Guide to Linux Installation and Administration, 2e1 Chapter 10 Managing System Resources.
Guide to Linux Installation and Administration, 2e1 Chapter 7 The Role of the System Administrator.
SUSE Linux Enterprise Server Administration (Course 3037) Chapter 6 Manage Linux Processes and Services.
Linux Security. See who's logged in 1) w (more information) 2) who (less information)
Generating Reports and Analyzing Logs 黃雁亭 陳麗雯 廖榆恬 1.
CENT 305 Information Systems Security Overview of System Logging syslog 1.
Quiz 15 minutes Open note, open book, open computer Finding the answer – working to get it – is what helps you learn I don’t care how you find the answer,
 Advanced programming for the unix environment (chapters 7,8,9 of both editions + chapter 13(2 nd edition))
Nezer J. Zaidenberg.  Advanced programming for the unix environment (chapters about processes)
Ch11: Syslog and Logfiles Presented by: Apichana Thiantanawat 06/11/02.
1 Periodic Processes and the cron Daemon The cron daemon is where all timed events are initiated. The cron system is serviced by the cron daemon. What.
System Administration HW2 Shell Script xclin. Computer Center, CS, NCTU 2 Requirements  Xferlog statistics (15%) use one-line command to show FTP transfer.
Syslog and Log Rotate. Computer Center, CS, NCTU 2 Log files  Execution information of each services sshd log files httpd log files ftpd log files 
Cosc 4750 Log files Logging policies Throw away all data immediately Reset log files at periodic intervals Rotate logs files, keeping data for a fixed.
What about errors in my Apples and Penguins
System Administration HW3 - Shell Script chenyp. Computer Center, CS, NCTU 2 Requirements  File statistics (20%+10%) use one-line command to show files.
Periodic Processes. Computer Center, CS, NCTU 2 Windows 7 工作排程.
Periodic Processes Periodically proceed the assigned jobs in BSD… Similar the one in windows.
System Administration Performance Monitoring For a server, it is crucial to monitor the health of the machine You need not only real time data collection.
COP 4343 Unix System Administration
Cosc 4750 Log files.
APRICOT 2008 Network Management Taipei, Taiwan February 20-24, 2008
Chapter 9 Periodic Processes
CIT 480: Securing Computer Systems
Syslog and Log Rotate yihshih arr. by pschiu.
Log management AfNOG 2008 Rabat, Morocco.
SUSE Linux Enterprise Desktop Administration
Syslog and Log Rotate yihshih.
Chapter 11 Syslog And Log Files
Syslog and Log Files Chapter 11.
CIT 485: Advanced Cybersecurity
Periodic Processes.
Chapter 9 Periodic Processes
CIT 470: Advanced Network and System Administration
Periodic Processes.
Syslog and Log Rotate.
Syslog and Log Rotate.
Periodic Processes.
Presentation transcript:

Chapter 11 Syslog and Log Rotate

Computer Center, CS, NCTU 2 Log files  Execution information of each services sshd log files httpd log files ftpd log files  Purpose For post tracking Like insurance

Computer Center, CS, NCTU 3 Logging Policies  Common schemes Throw away all log files Rotate log files at periodic intervals Archiving log files #!/bin/sh /usr/bin/cd /var/log /bin/mv logfile.2.gz logfile.3.gz /bin/mv logfile.1.gz logfile.2.gz /bin/mv logfile logfile.1 /usr/bin/touch logfile /bin/kill –signal pid /usr/bin/gzip logfile * * * /usr/bin/tar czvf /backup/logfile.`/bin/date +\%Y\%m\%d`.tar.gz /var/log

Computer Center, CS, NCTU 4 Finding Log Files  Ways and locations Common directory  /var/log, /var/adm Read software configuration files  Ex: /usr/local/etc/apache22/httpd.conf TransferLog /home/www/logs/access.log See /etc/syslog.conf

Computer Center, CS, NCTU 5 Under /var/log in FreeBSD (1)  You can see that under /var/log … Lots of logs chbsd [/var/log] -chwong- ls Xorg.0.log cron.1.bz2 maillog.2.bz2 mount.yesterday sendmail.st.7 Xorg.0.log.old cron.2.bz2 maillog.3.bz2 pf.today sendmail.st.8 auth.log cron.3.bz2 maillog.4.bz2 ppp.log sendmail.st.9 auth.log.0.bz2 cvsup-all.log maillog.5.bz2 security setuid.today auth.log.1.bz2 debug.log maillog.6.bz2 sendmail.st setuid.yesterday auth.log.2.bz2 dmesg.today maillog.7.bz2 sendmail.st.0 slip.log auth.log.3.bz2 dmesg.yesterday messages sendmail.st.1 userlog auth.log.4.bz2 installworld.log messages.0.bz2 sendmail.st.10 wtmp auth.log.5.bz2 lastlog messages.1.bz2 sendmail.st.2 wtmp.0 auth.log.6.bz2 lpd-errs messages.2.bz2 sendmail.st.3 wtmp.1 auth.log.7.bz2 maillog messages.3.bz2 sendmail.st.4 wtmp.2 cron maillog.0.bz2 messages.4.bz2 sendmail.st.5 wtmp.3 cron.0.bz2 maillog.1.bz2 mount.today sendmail.st.6 xferlog

Computer Center, CS, NCTU 6 Under /var/log in FreeBSD (2)  Logs – because of syslogd chbsd [/var/log] -chwong- cat /etc/syslog.conf *.err;kern.warning;auth.notice;mail.crit /dev/console *.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err /var/log/messages security.* /var/log/security auth.info;authpriv.info /var/log/auth.log mail.info /var/log/maillog lpr.info /var/log/lpd-errs ftp.info /var/log/xferlog cron.* /var/log/cron *.=debug /var/log/debug.log *.emerg *

Computer Center, CS, NCTU 7 Under /var/log in FreeBSD (3)  Logs are rotated – because newsyslog facility In crontab newsyslog.conf chbsd [/etc] -chwong- grep newsyslog /etc/crontab 0 * * * * root newsyslog chbsd [/etc] -chwong- cat /etc/newsyslog.conf # logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] /var/log/all.log J /var/log/amd.log * J /var/log/auth.log * JC /var/log/console.log * J /var/log/cron * JC /var/log/daily.log JN /var/log/debug.log * JC /var/log/maillog JC /var/log/messages * JC /var/log/monthly.log * $M1D0 JN /var/log/security * JC /var/log/sendmail.st * 168 B

Computer Center, CS, NCTU 8 Vendor Specifics  FreeBSD newsyslog utility /etc/newsyslog.conf  Red Hat logrotate utility /etc/logrotate.conf, /etc/logrotate.d directory linux1 [/etc/logrotate.d] -chwong- cat aptitude /var/log/aptitude { rotate 6 monthly compress missingok notifempty }

Computer Center, CS, NCTU 9 Files Not to Manage  You can manage most log files yourself, except … /var/log/lastlog (/var/adm/lastlog)  Record of each user ’ s last login /var/run/utmp (/etc/utmp)  Record of each user that is currently logged in

Syslog

Computer Center, CS, NCTU 11 Syslog – The system event logger (1)  Two main functions To release programmers from the tedious of writing log files To put administrators in control of logging  Three parts: syslogd, /etc/syslog.conf  The logging daemon and configure file openlog(), syslog(), closelog()  Library routines to use syslogd logger  A user command that use syslogd from shell

Computer Center, CS, NCTU 12 Syslog – The system event logger (2) /var/run/log chbsd [/var/run] -chwong- ls -l /var/run/log srw-rw-rw- 1 root wheel 0 Nov 4 11:45 /var/run/log

Computer Center, CS, NCTU 13 Configuring syslogd (1)  Basic format selector action  Selector: program.level –Program: the program that sends the log message –Level: the message severity level  Action: tells what to do with the message Ex:  mail.info/var/log/maillog

Computer Center, CS, NCTU 14 Configuring syslogd (2)  selector Syntax: facility.level  Facility and level are predefined (see next page) Combined selector  facility.level  facility1,facility2.level  facility1.level;facility2.level  *.level Level indicate the minimum importance that a message must be logged A message matching any selector will be subject to the line’s action

Computer Center, CS, NCTU 15 Configuring syslogd (3)

Computer Center, CS, NCTU 16 Configuring syslogd (4)  Action filename  Write the message to a local  Forward the message to the syslogd on  Forwards the message to the host at that IP address user1, user2  Write the message to the user ’ s screen if they are logged in *  Write the message to all user logged in

Computer Center, CS, NCTU 17 Configuring syslogd (5)  Ex: *.emerg/dev/console *.err;kern,mark.debug;auth.notice;user.none/var/adm/console.log *alert;kern.crit;local0,local1,local2.inforoot lpr.err 

Computer Center, CS, NCTU 18 Configuring syslogd (6)  Output of syslogd Aug 28 20:00:00 chbsd newsyslog[37324]: logfile turned over due to size>100K Aug 28 20:01:45 chbsd sshd[37338]: error: PAM: authentication error for root from Aug 28 20:01:47 chbsd sshd[37338]: error: PAM: authentication error for root from Aug 28 20:07:15 chbsd sshd[37376]: error: PAM: authentication error for root from Aug 28 20:07:17 chbsd sshd[37376]: error: PAM: authentication error for root from Aug 30 09:47:49 chbsd sudo: chwong : TTY=ttyp4 ; PWD=/usr/home/chwong ; USER=root ; COMMAND= Aug 30 22:02:02 chbsd kernel: arp: moved from 00:d0:b7:b2:5d:89 to 00:04:e2:10: Aug 30 22:05:13 chbsd kernel: arp: moved from 00:04:e2:10:11:9c to 00:d0:b7:b2: Sep 1 14:50:11 chbsd kernel: arplookup failed: host is not on local network Sep 3 13:16:29 chbsd sudo: chwong : TTY=ttyp4 ; PWD=/usr/ports ; USER=root ; COMMAND=/usr/b Sep 3 13:18:40 chbsd sudo: chwong : TTY=ttyp4 ; PWD=/usr/ports ; USER=root ; COMMAND=/usr/l Sep 3 13:25:06 chbsd sudo: chwong : TTY=ttyp4 ; PWD=/usr/ports ; USER=root ; COMMAND=/usr/l Sep 3 13:27:09 chbsd kernel: arp: moved from 00:d0:b7:b2:5d:89 to 00:04:e2:10: Sep 3 13:27:14 chbsd kernel: arp: moved from 00:04:e2:10:11:9c to 00:d0:b7:b2: Sep 3 15:27:05 chbsd sudo: chwong : TTY=ttyp4 ; PWD=/usr/ports ; USER=root ; COMMAND=/usr/l Sep 3 15:27:10 chbsd sudo: chwong : TTY=ttyp4 ; PWD=/usr/ports ; USER=root ; COMMAND=/usr/l Sep 3 15:27:25 chbsd sudo: chwong : TTY=ttyp4 ; PWD=/usr/ports ; USER=root ; COMMAND=/usr/l

Computer Center, CS, NCTU 19 Software that use syslog

Computer Center, CS, NCTU 20 FreeBSD Enhancement (1)  Facility name FreeBSD allows you to select messages based on the name of the program  Severity level !named *.*/var/log/named.log

Computer Center, CS, NCTU 21 FreeBSD Enhancement (2)  Restriction log messages from remote hosts syslogd –a *.csie.nctu.edu.tw –a /24 rc.conf syslogd_enable="YES" syslogd_flags="-a /24:* -a /24:*"