Linux Box Admin
Trusted Remote Administration
logo

Tilde
What's new
Articles
Micro HowTos
About
Contact







What's new
Logrotate
(0 votes)
System Administration
Wednesday, 07 March 2007
   
    Logrotate    
     
       
 

Logrotate is program that manages and optionally compresses log files. The configuration determines how many files of each type are kept based on age and/or file size.

The global configuration file is /etc/logrotate.conf. Some distros also include program specific configuration files stored in /etc/logrotate.d/. Each type of log file can have different rotation schedules.

Global defaults

In most systems, the default configuration keeps 4 backup log files and rotates them weekly.

Sample apache logrotate configuration

/var/log/httpd/*log {
missingok
notifempty
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null`
endscript
}

The path defines what log files are controlled by this entry.
missingok means to continue if no logs files are found.
notifempty means do not rotate the file if it is empty.
sharedscripts means run the prerotate and postrotate scripts once regardless of how many log files are rotated.
postrotate defines a command to run after log files have been rotated. In this case, it sends the hang up signal to apache to tell it to reread its configuration file.

Custom apache log rotation

This configuration keeps 12 log files and rotates them monthly:

/var/log/httpd/*log {
missingok
notifempty
monthly
rotate 12
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null`
endscript
}

 

This configuration keeps 7 log files and rotates them when they reach 10 MB in size:
/var/log/httpd/*log {
missingok
notifempty
size 10M
rotate 7
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null`
endscript
}

 

   
       
         
 
RPM commands
(2 votes)
System Administration
Wednesday, 07 March 2007
  RPM commands

Location of RPM database files:

/var/lib/rpm/

To install a package (i=install v=verbose h=show hash marks):

rpm -ivh package.rpm

To uninstall (erase) a package:

rpm -e package-name

To upgrade a package:

rpm -Uvh package.rpm

To test a package without installing (checks dependencies):

rpm -Uvh --test package.rpm

To verify a package:

rpm -Vvv package-name

To verify ALL installed packages:

rpm -Va

To find installed package names matching a pattern:

rpm -qa | grep pattern

To see what files a new package is going to install:

rpm -qpl package.rpm

To see what files belong to an installed package:

rpm -ql package-name

To see what package owns a file:

rpm -qf filename

To rebuild the RPM database:

rpm --rebuilddb

To bypass running the install/uninstall scripts in a package:

rpm -ivh --no-scripts package.rpm
also
rpm -e --no-scripts package-name

Mass install:

rpm -ivh *.rpm

Mass uninstall of packages that match a pattern:

rpm -qa | grep pattern | xargs rpm -e
 
Sar
(4 votes)
System Administration
Wednesday, 07 March 2007
   
    Sar    
     
       
 

Sar is the "system activity report" program. In Linux, it is often found in the sysstat package. The package includes the sadc program that gathers stats and stores them in binary files in /var/log/sa/, and the report programs, sar, mpstat, and iostat. It also includes the sa1 and sa2 shell scripts that execute sadc and produce daily summaries of the data.

Capturing performance data

If you install sar from a package, several scripts may be set up automatically to gather data. Check the cron configuration for sa1 and sa2 scripts. If the scripts are not scheduled to run, here is a typical cron configuration:
# run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib/sa/sa1 1 1
# generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib/sa/sa2 -A

To show CPU performance:

sar -u

To show average IO performance over time:

sar -b

To show average IO performance by device:

iostat

To show average network performance:

sar -n FULL

To show network performance by device:

sar -n DEV

To show network errors by device:

sar -n EDEV

To show memory performance:

sar -R

To show paging (swap file) performance:

sar -W
   
       
         
 
<< Start < Prev 1 2 3 4 5 6 7 8 Next > End >>

Results 40 - 52 of 104


Copyright © 2006,2007 Linux Box Admin.

 
My NHL fan blog