# Log cron stuff
cron.* /var/log/cron
# Everybody gets emergency messages
*.emerg :omusrmsg:*
# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler
# Save boot messages also to boot.log
local7.* /var/log/boot.log
格式
日志类型.日志级别 存放日志文件
3.1 日志类型
类型
说明
auth
pam产生的日志
authpriv
ssh、ftp等登录信息的验证信息
corn
时间任务相关
kern
内核
lpr
打印
mail
邮件
mark(syslog)-rsyslog
服务内部的信息,时间标识
news
新闻组
user
用户程序产生的相关信息
uucp
unit to nuix copy主机之间相关的通信
local 1-7
自定义的日志设备
3.2 日志级别
日志级别
说明
debug
有调式信息的,日志通信最多
info
一般信息日志,最常用
notice
最具有重要性的普通条件的信息
warning
警告级别
err
错误级别,阻止某个功能或者模块不能正常工作的信息
crit
严重级别,阻止整个系统或者整个软件不能正常工作的信息
alert
需要立刻修改的信息
emerg
内核崩溃等重要信息
none
什么都不记录
注意:从上到下,级别从低到高,记录信息越来越少
4. 日志文件内容详细介绍
事件产生的时间 产生事件的服务器的主机名 产生事件的服务名或程序名 事件的具体信息
查看/var/log/secure日志
5. 自定义日志保存起来
vim /etc/rsyslog.conf
编辑
*.* /var/log/jerry.log
重启,查看,会有内容
4. 日志轮替
/etc/logrotate.conf 为 logrotate 的全局配置文件
# rotate log files weekly,每周对日志文件进行一次轮替
weekly
#keep 4 weeks worth of backlogs,共保存4份日志文件,当建立新的日志文件时,旧的将会被删除
rotate 4
# create new (empty) log files after rotating old ones,创建新的空的日志文件,在日志轮替后
create
# use date as a suffix of the rotated file,使用日期作为日志轮替文件的后缀
dateext
#uncomment this if you want your log files compressed,日志文件是否压缩。如果取消注释,则日志会在转储的同时进行压缩
#compress
#RPM packages drop log rotation information into this directory
include /etc/logrotate.d
#包含/letc/logrotate.d/目录中所有的子配置文件。也就是说会把这个目录中所有子配置文件读取进来,#下面是单独设置,优先级更高。
# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
monthly #每月对日志文件进行一次轮替
create 0664 root utmp #建立的新日志文件,权限是0664 ,所有者是 root ,所属组是utmp组
minsize 1M #日志文件最小轮替大小是 1MB。也就是日志一定要超过1MB才会轮替,否则就算时间达到一个月,也不进行日志转存
rotate 1 #仅保留一个日志备份。也就是只有wtmp和 wtmp.1日志保留而已
}
/var/log/btmp {
missingok # 如果日志不存在,则忽略该日志的警告信息
monthly
create 0600 root utmp
rotate l
}
1[root@localhost~]# fdisk /dev/sdb
2Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
3Building a new DOS disklabel withdisk identifier 0x4fde4cd0.4Changes will remain in memory only, until you decide towrite them.5After that, of course, the previous content won't be recoverable.678Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)91011 WARNING: DOS-compatible mode is deprecated. It's strongly recommended to12switch off the mode (command 'c') and change display units to13 sectors (command 'u').141516Command(m for help): n
17Command action
18 e extended
19 p primary partition (1-4)20 p
21Partition number (1-4):122First cylinder (1-2610,default1):23Usingdefault value 124Last cylinder,+cylinders or +size{K,M,G}(1-2610,default2610):+500M
252627Command(m for help): n
28Command action
29 e extended
30 p primary partition (1-4)31 p
32Partition number (1-4):233First cylinder (15-2610,default15):34Usingdefault value 1535Last cylinder,+cylinders or +size{K,M,G}(15-2610,default2610):36Usingdefault value 261037 #查看分区
38Command(m for help): p
394041Disk/dev/sdb:21.5 GB,21474836480 bytes
42255 heads,63 sectors/track,2610 cylinders
43Units= cylinders of 16065*512=8225280 bytes
44Sector size (logical/physical):512 bytes /512 bytes
45I/O size (minimum/optimal):512 bytes /512 bytes
46Disk identifier:0x4fde4cd0474849DeviceBootStartEndBlocksIdSystem50/dev/sdb1 114112423+83Linux51/dev/sdb2 1526102085237083Linux52 #保存并退出
53Command(m for help): w
54The partition table has been altered!
4.3 对/dev/sdb分区进行格式化
mkfs.ext4 /dev/sdb1
mkfs.ext4 /dev/sdb2
4.4 挂载新的磁盘到目录上
mkdir -p /mnt/boot /mnt/sysroot
mount /dev/sdb1 /mnt/boot
mount /dev/sdb2 /mnt/sysroot/