<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>System Log (系统日志) &#8211; Eternal Center</title>
	<atom:link href="https://eternalcenter-2021-12.github.io/category/system/system-network-system-security-system-log/system-log/feed/" rel="self" type="application/rss+xml" />
	<link>https://eternalcenter-2021-12.github.io/</link>
	<description></description>
	<lastBuildDate>Sun, 26 Dec 2021 09:14:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>[内容] Linux 关机或重启记录的查看</title>
		<link>https://eternalcenter-2021-12.github.io/viewing-of-shutdown-or-restart-records/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Wed, 10 Nov 2021 13:09:21 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System General Log (系统普通日志)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Operation (系统操作)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=18281</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-code"><code># /usr/bin/last -xF | egrep "reboot|shutdown|runlevel|system"</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[命令] Linux 命令  dmesg （查看开机日志）</title>
		<link>https://eternalcenter-2021-12.github.io/dmesg/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Fri, 29 Oct 2021 09:17:24 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System General Log (系统普通日志)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=18117</guid>

					<description><![CDATA[内容一：dmesg 简介 Linux 的 kernel 会把开机日子存储在 ring buffer 和 /var/log/message 中，其中 ring buffer 里的开机日志可以使用 dmesg 来查看，如果开机时的提示信息来不及查看的话，可以通过 dmesg 命令来查看 内容二：dmesg 的选项 1) -c 显示 ring buffer 的日志后清空 ring buffer2) -n 显示日志的层级3) -cn 显示 ring buffer 的日志后清空 ring buffer，同时显示日志的层级4) -s 设置缓冲区的大小，默认为 8196 与 ring buffer 的大小一样 内容三：dmesg 命令的使用案例3.1 查看所有开机日志 3.2 查看所有日志，显示 ring buffer 的日志后清空 ring buffer，同时显示日志的层级 3.3 &#8230; <p class="link-more"><a href="https://eternalcenter-2021-12.github.io/dmesg/" class="more-link">Continue reading<span class="screen-reader-text"> "[命令] Linux 命令  dmesg （查看开机日志）"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h4>内容一：dmesg 简介</h4>



<p>Linux 的 kernel 会把开机日子存储在 ring buffer 和 /var/log/message 中，其中 ring buffer 里的开机日志可以使用 dmesg 来查看，如果开机时的提示信息来不及查看的话，可以通过 dmesg 命令来查看</p>



<h4>内容二：dmesg 的选项</h4>



<p>1) -c 显示 ring buffer 的日志后清空 ring buffer<br>2) -n 显示日志的层级<br>3) -cn 显示 ring buffer 的日志后清空 ring buffer，同时显示日志的层级<br>4) -s 设置缓冲区的大小，默认为 8196 与 ring buffer 的大小一样</p>



<h4>内容三：dmesg 命令的使用案例<br>3.1 查看所有开机日志</h4>



<pre class="wp-block-code"><code># dmesg | less</code></pre>



<h4>3.2 查看所有日志，显示 ring buffer 的日志后清空 ring buffer，同时显示日志的层级</h4>



<pre class="wp-block-code"><code># dmesg -cn</code></pre>



<h4>3.3 查看所有失败的开机日志</h4>



<pre class="wp-block-code"><code># dmesg | egrep -i "fail|warn|error"</code></pre>



<p></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[步骤] SELinux  的启用 （openSUSE&#038;SUSE  版） （不建议）</title>
		<link>https://eternalcenter-2021-12.github.io/selinux-opensusesuse/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Tue, 01 Jun 2021 08:50:14 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[SELinux]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System File Security (系统文件安全)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Process Security (系统进程安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Security Log (系统安全日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=14516</guid>

					<description><![CDATA[软件准备： 在 SELinuxProject 的官网上下载 SELinux 策略 UseRefpolicy： https://github.com/SELinuxProject/refpolicy/wiki/UseRefpolicy 注意： 1) 如果使用此文的方法将 openSUSE&#38;SUSE 的 SELinux 设置为 Enforcing 则系统将无法设置 IP 地址2) 如果使用此文的方法开启了 SELinux 并且将所有的布尔（boolean）值开启，则系统将无法关机，开启所有布尔值的方法：# for i in semanage boolean -l &#124; awk '{print $1}'; do echo $i;setsebool -P $i 1; done 正文： 步骤目录： 步骤一：安装 SELinux 组件 步骤二：安装 SELinux 策略2.1 解压包含 SELinux 策略的压缩包2.2 将 SELinux 策略移动到 SELinux 配置文件的位置2.3 &#8230; <p class="link-more"><a href="https://eternalcenter-2021-12.github.io/selinux-opensusesuse/" class="more-link">Continue reading<span class="screen-reader-text"> "[步骤] SELinux  的启用 （openSUSE&#038;SUSE  版） （不建议）"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2>软件准备：</h2>



<p>在 SELinuxProject 的官网上下载 SELinux 策略 UseRefpolicy：</p>



<p class="has-text-align-center"><a href="https://github.com/SELinuxProject/refpolicy/wiki/UseRefpolicy" target="_blank" rel="noreferrer noopener">https://github.com/SELinuxProject/refpolicy/wiki/UseRefpolicy</a></p>



<h2>注意：</h2>



<p>1) 如果使用此文的方法将 openSUSE&amp;SUSE 的 SELinux 设置为 Enforcing 则系统将无法设置 IP 地址<br>2) 如果使用此文的方法开启了 SELinux 并且将所有的布尔（boolean）值开启，则系统将无法关机，开启所有布尔值的方法：# for i in <code>semanage boolean -l | awk '{print $1}'</code>; do echo $i;setsebool -P $i 1; done</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2>正文：</h2>



<h2>步骤目录：</h2>



<h4>步骤一：安装 SELinux 组件</h4>



<h4>步骤二：安装 SELinux 策略<br>2.1 解压包含 SELinux 策略的压缩包<br>2.2 将 SELinux 策略移动到 SELinux 配置文件的位置<br>2.3 进入到和 SELinux 策略相同目录下<br>2.4 查看 SELinux 策略的安装手册<br>2.5 创建 SELinux 策略的配置文件<br>2.6 创建 SELinux 策略<br>2.7 编译 SELinux 策略<br>2.8 安装 SELinux 策略</h4>



<h4>步骤三：配置 SELinux 配置文件<br>3.1 在 SELinux 配置文件中将 SELinux 设置为 Permissive 状态<br>3.2 在系统内核中禁止使用 AppArmor 使用 SELinux 并且将 SELinux状态设置为 Permissive<br>3.2.1 设置 grub 文件<br>3.2.2 让刚刚设置的 grub 文件生效<br>3.3 刷新系统内所有文件的标签</h4>



<h4>步骤四：重启系统让 SELinux 生效</h4>



<h2>具体的操作步骤：</h2>



<h4>步骤一：安装 SELinux 组件</h4>



<pre class="wp-block-code"><code># zypper in libselinux1 libsemanage1 libsepol-devel libsepol1 libselinux-devel mcstrans libselinux1-32bit policycoreutils checkpolicy libsemanage-devel setools-tcl setools-libs setools-java setools-devel setools-console selinux-tools python3-policycoreutils python3-selinux python3-semanage python3-setools restorecond</code></pre>



<h4>步骤二：安装 SELinux 策略<br>2.1 解压包含 SELinux 策略的压缩包</h4>



<pre class="wp-block-code"><code># tar -xvf refpolicy-2.20210203.tar.bz2</code></pre>



<p>（补充：这里以解压 refpolicy-2.20210203.tar.bz2 压缩包为例）</p>



<h4>2.2 将 SELinux 策略移动到 SELinux 配置文件的位置</h4>



<pre class="wp-block-code"><code># mv refpolicy /etc/selinux/</code></pre>



<h4>2.3 进入到和 SELinux 策略相同目录下</h4>



<pre class="wp-block-code"><code># cd /etc/selinux/refpolicy/</code></pre>



<h4>2.4 查看 SELinux 策略的安装手册</h4>



<pre class="wp-block-code"><code># cat INSTALL</code></pre>



<h4>2.5 创建 SELinux 策略的配置文件</h4>



<pre class="wp-block-code"><code># make conf</code></pre>



<h4>2.6 创建 SELinux 策略</h4>



<pre class="wp-block-code"><code># make policy</code></pre>



<h4>2.7 编译 SELinux 策略</h4>



<pre class="wp-block-code"><code># make install</code></pre>



<h4>2.8 安装 SELinux 策略</h4>



<pre class="wp-block-code"><code># make load</code></pre>



<h4>步骤三：配置 SELinux 配置文件<br>3.1 在 SELinux 配置文件中将 SELinux 设置为 Permissive 状态</h4>



<pre class="wp-block-code"><code># vim /etc/selinux/config</code></pre>



<p>创建以下内容：</p>



<pre class="wp-block-code"><code># This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=refpolicy</code></pre>



<h4>3.2 在系统内核中禁止使用 AppArmor 使用 SELinux 并且将 SELinux状态设置为 Permissive<br>3.2.1 设置 grub 文件</h4>



<pre class="wp-block-code"><code># vim /etc/default/grub</code></pre>



<p>在这一行里：</p>



<pre class="wp-block-code"><code>GRUB_CMDLINE_LINUX_DEFAULT="......"</code></pre>



<pre class="wp-block-code"><code>添加以下内容：</code></pre>



<pre class="wp-block-code"><code>GRUB_CMDLINE_LINUX_DEFAULT="...... security=selinux selinux=1 enforcing=0"</code></pre>



<h4>3.2.2 让刚刚设置的 grub 文件生效</h4>



<pre class="wp-block-code"><code># grub2-mkconfig -o /boot/grub2/grub.cfg</code></pre>



<h4>3.3 刷新系统内所有文件的标签</h4>



<pre class="wp-block-code"><code># restorecon -Rp /</code></pre>



<h4>步骤四：重启系统让 SELinux 生效</h4>



<pre class="wp-block-code"><code># reboot</code></pre>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2>参考文献：</h2>



<p class="has-text-align-center">https://documentation.suse.com/sles/15-SP2/html/SLES-all/cha-selinux.html</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[内容] Linux SELinux 状态的设置</title>
		<link>https://eternalcenter-2021-12.github.io/selinux-state/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Mon, 31 May 2021 13:37:41 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[SELinux]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System File Security (系统文件安全)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Process Security (系统进程安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Security Log (系统安全日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=14456</guid>

					<description><![CDATA[内容目录： 内容一：SELinux 的状态 内容二：永久切换 SELinux 状态2.1 将 SELinux 永久切换至 Disabled 状态2.1.1 修改 SELinux 配置文件2.1.2 重启系统2.1.3 查看 SELinux 状态2.2 将 SELinux 永久切换至 Permissive 状态2.2.1 修改 SELinux 配置文件2.2.2 重启系统2.2.3 查看 SELinux 状态2.3 将 SELinux 永久切换至 Enforcing 状态2.3.1 修改 SELinux 配置文件2.3.2 重启系统2.3.3 查看 SELinux 状态 内容三：临时切换 SELinux 状态3.1 临时切换到 Permissive 状态3.1.1 临时切换到 Permissive 状态3.1.2 查看 SELinux 状态3.2 临时切换到 &#8230; <p class="link-more"><a href="https://eternalcenter-2021-12.github.io/selinux-state/" class="more-link">Continue reading<span class="screen-reader-text"> "[内容] Linux SELinux 状态的设置"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2>内容目录：</h2>



<h4>内容一：SELinux 的状态</h4>



<h4>内容二：永久切换 SELinux 状态<br>2.1 将 SELinux 永久切换至 Disabled 状态<br>2.1.1 修改 SELinux 配置文件<br>2.1.2 重启系统<br>2.1.3 查看 SELinux 状态<br>2.2 将 SELinux 永久切换至 Permissive 状态<br>2.2.1 修改 SELinux 配置文件<br>2.2.2 重启系统<br>2.2.3 查看 SELinux 状态<br>2.3 将 SELinux 永久切换至 Enforcing 状态<br>2.3.1 修改 SELinux 配置文件<br>2.3.2 重启系统<br>2.3.3 查看 SELinux 状态</h4>



<h4>内容三：临时切换 SELinux 状态<br>3.1 临时切换到 Permissive 状态<br>3.1.1 临时切换到 Permissive 状态<br>3.1.2 查看 SELinux 状态<br>3.2 临时切换到 Enforcing 状态<br>3.2.1 临时切换到 Enforcing 状态<br>3.2.2 查看 SELinux 状态</h4>



<h2>具体的内容：</h2>



<h4>内容一：SELinux 的状态</h4>



<p>1) Disabled：完全关闭 SELinux<br>2) Permissive：即使违反了策略也依旧可以执行，但是违反策略的记录会被记录在日志中<br>3) Enforcing：如果违反了策略就不能之行</p>



<h4>内容二：永久切换 SELinux 状态<br>2.1 将 SELinux 永久切换至 Disabled 状态<br>2.1.1 修改 SELinux 配置文件</h4>



<pre class="wp-block-code"><code># vim /etc/selinux/config</code></pre>



<p>将以下内容：</p>



<pre class="wp-block-code"><code>......
SELINUX=......
......</code></pre>



<p>修改为：</p>



<pre class="wp-block-code"><code>......
SELINUX=disabled
......</code></pre>



<h4>2.1.2 重启系统</h4>



<pre class="wp-block-code"><code># reboot</code></pre>



<h4>2.1.3 查看 SELinux 状态</h4>



<pre class="wp-block-code"><code># getenforce 
Disabled</code></pre>



<h4>2.2 将 SELinux 永久切换至 Permissive 状态<br>2.2.1 修改 SELinux 配置文件</h4>



<pre class="wp-block-code"><code># vim /etc/selinux/config</code></pre>



<p>将以下内容：</p>



<pre class="wp-block-code"><code>......
SELINUX=......
......</code></pre>



<p>修改为：</p>



<pre class="wp-block-code"><code>......
SELINUX=permissive
......</code></pre>



<h4>2.2.2 重启系统</h4>



<pre class="wp-block-code"><code># reboot</code></pre>



<h4>2.2.3 查看 SELinux 状态</h4>



<pre class="wp-block-code"><code># getenforce 
Permissive</code></pre>



<h4>2.3 将 SELinux 永久切换至 Enforcing 状态<br>2.3.1 修改 SELinux 配置文件</h4>



<pre class="wp-block-code"><code># vim /etc/selinux/config</code></pre>



<p>将以下内容：</p>



<pre class="wp-block-code"><code>......
SELINUX=......
......</code></pre>



<p>修改为：</p>



<pre class="wp-block-code"><code>......
SELINUX=enforcing
......</code></pre>



<h4>2.3.2 重启系统</h4>



<pre class="wp-block-code"><code># reboot</code></pre>



<h4>2.3.3 查看 SELinux 状态</h4>



<pre class="wp-block-code"><code># getenforce 
Enforcing</code></pre>



<h4>内容三：临时切换 SELinux 状态<br>3.1 临时切换到 Permissive 状态<br>3.1.1 临时切换到 Permissive 状态</h4>



<pre class="wp-block-code"><code># setenfoce 0</code></pre>



<p>（<br>注意：<br>1) 系统重启后失效<br>2) 只能从 Enforcing 状态切换到 Permissive 状态<br>）</p>



<h4>3.1.2 查看 SELinux 状态</h4>



<pre class="wp-block-code"><code># getenforce 
Permissive</code></pre>



<h4>3.2 临时切换到 Enforcing 状态<br>3.2.1 临时切换到 Enforcing 状态</h4>



<pre class="wp-block-code"><code># setenfoce 1</code></pre>



<p>（<br>注意：<br>1) 系统重启后失效<br>2) 只能从 Permissive 状态切换到 Enforcing 状态<br>）</p>



<h4>3.2.2 查看 SELinux 状态</h4>



<pre class="wp-block-code"><code># getenforce 
Enforcing</code></pre>



<p></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[实验] Linux 远程日志的集中管理和分文件存储 （通过 Rsyslog 实现）</title>
		<link>https://eternalcenter-2021-12.github.io/rsyslog-set/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Mon, 12 Oct 2020 14:20:47 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Rsyslog]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System General Log (系统普通日志)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=11535</guid>

					<description><![CDATA[步骤目录： 步骤一：规划拓扑1.1 服务器列表1.2 服务器列表简介 步骤二：系统环境要求 步骤三：配置 rsyslog 服务端3.1 修改 rsyslog 配置文件的案例3.1.1 案例一3.1.2 案例二3.1.3 案例三3.1.4 案例四3.1.5 案例五3.2 重启 rsyslog 服务 步骤四：配置 rsyslog 客户端4.1 修改 rsyslog 客户端的案例4.2 重启 rsyslog 服务 步骤五：测试 rsyslog 服务5.1 在 rsyslog 客户端上发送日志5.2 在 rsyslog 服务端上查看日志 具体的操作步骤： 步骤一：规划拓扑1.1 服务器列表 rsyslog 服务端 IP 地址:192.168.0.11rsyslog 客户端 IP 地址:192.168.0.12 1.2 服务器列表简介 rsyslog 客户端将日志发送给 rsyslog 服务端，并实现分文件存储 步骤二：系统环境要求 1) &#8230; <p class="link-more"><a href="https://eternalcenter-2021-12.github.io/rsyslog-set/" class="more-link">Continue reading<span class="screen-reader-text"> "[实验] Linux 远程日志的集中管理和分文件存储 （通过 Rsyslog 实现）"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2>步骤目录：</h2>



<h4>步骤一：规划拓扑<br>1.1 服务器列表<br>1.2 服务器列表简介</h4>



<h4>步骤二：系统环境要求</h4>



<h4>步骤三：配置 rsyslog 服务端<br>3.1 修改 rsyslog 配置文件的案例<br>3.1.1 案例一<br>3.1.2 案例二<br>3.1.3 案例三<br>3.1.4 案例四<br>3.1.5 案例五<br>3.2 重启 rsyslog 服务</h4>



<h4>步骤四：配置 rsyslog 客户端<br>4.1 修改 rsyslog 客户端的案例<br>4.2 重启 rsyslog 服务</h4>



<h4>步骤五：测试 rsyslog 服务<br>5.1 在 rsyslog 客户端上发送日志<br>5.2 在 rsyslog 服务端上查看日志</h4>



<h2>具体的操作步骤：</h2>



<h4>步骤一：规划拓扑<br>1.1 服务器列表</h4>



<p>rsyslog 服务端 IP 地址:192.168.0.11<br>rsyslog 客户端 IP 地址:192.168.0.12</p>



<h4>1.2 服务器列表简介</h4>



<p>rsyslog 客户端将日志发送给 rsyslog 服务端，并实现分文件存储</p>



<h4>步骤二：系统环境要求</h4>



<p>1) 所有服务器的系统都需要是 CentOS 8 版本<br>2) 所有服务器都要关闭防火墙<br>3) 所有服务器都要关闭 SELinux<br>4) 需要按照拓扑图给对应的服务器配置好 IP 地址和主机名<br>5) 所有服务器都要可以相互 ping 通自己和对方的 IP 地址和主机名</p>



<h4>步骤三：配置 rsyslog 服务端<br>3.1 修改 rsyslog 配置文件的案例<br>3.1.1 案例一</h4>



<p>（只在 rsyslog 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rsyslog.conf</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
module(load="imudp")
input(type="imudp" port="514")
module(load="imtcp")
input(type="imtcp" port="514")</code></pre>



<p>（<br>补充：<br>1) 使用 UDP 的 514 端口接收日志<br>2) 使用 TCP 的 514 端口接收日志<br>3) 此配置会将所有 rsyslog 客户端的日志存储在 rsyslog 服务端的 /var/log/message 里<br>）</p>



<h4>3.1.2 案例二</h4>



<p>（只在 rsyslog 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rsyslog.conf</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
module(load="imudp")
input(type="imudp" port="514")
module(load="imtcp")
input(type="imtcp" port="514")

$template DynFile,"/var/log/%HOSTNAME%.log"
*.* -?DynFile
&amp; ~</code></pre>



<p>（<br>补充：<br>1) 使用 UDP 的 514 端口接收日志<br>2) 使用 TCP 的 514 端口接收日志<br>3) 此配置会将每个 rsyslog 客户端的日志单独存储在 /var/log/ 下的一个文件里，此文件会以其所属系统名命名<br>）</p>



<h4>3.1.3 案例三</h4>



<p>（只在 rsyslog 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rsyslog.conf</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
module(load="imudp")
input(type="imudp" port="514")
module(load="imtcp")
input(type="imtcp" port="514")

$template DynFile,"/var/log/remotelog/%HOSTNAME%-%$YEAR%-%$MONTH%-%$DAY%-messages.log"
*.* -?DynFile
&amp; ~</code></pre>



<p>（<br>补充：<br>1) 使用 UDP 的 514 端口接收日志<br>2) 使用 TCP 的 514 端口接收日志<br>3) 此配置会将每个 rsyslog 客户端的日志单独存储在 /var/log/remotelog 下的一个文件里，此文件会以其创建时间和其所属系统名命名<br>）</p>



<h4>3.1.4 案例四</h4>



<p>（只在 rsyslog 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rsyslog.conf</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
module(load="imudp")
input(type="imudp" port="514")
module(load="imtcp")
input(type="imtcp" port="514")

$template DynFile,"/var/log/remotelog/%HOSTNAME%-%$YEAR%-%$MONTH%-%$DAY%-messages.log"
:fromhost-ip,!isequal,"127.0.0.1" -?DynFile
&amp; ~</code></pre>



<p>（<br>补充：<br>1) 使用 UDP 的 514 端口接收日志<br>2) 使用 TCP 的 514 端口接收日志<br>3) 此配置会将每个 rsyslog 客户端的日志单独存储在 /var/log/ 下的一个文件里，此文件会以其创建时间和其所属系统名命名<br>4) 此配置不会单独存储 rsyslog 服务端的日志<br>）</p>



<h4>3.1.5 案例五</h4>



<p>（只在 rsyslog 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rsyslog.conf</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
module(load="imudp")
input(type="imudp" port="514")
module(load="imtcp")
input(type="imtcp" port="514")

$template DynFile,"/var/log/syslog/system-%HOSTNAME%/messages.log"
*.* -?DynFile
&amp; ~</code></pre>



<p>（<br>补充：<br>1) 使用 UDP 的 514 端口接收日志<br>2) 使用 TCP 的 514 端口接收日志<br>3) 此配置会将每个 rsyslog 客户端的日志单独存储在 /var/log/ 下某个目录的 messages 文件里，此目录会以其所属系统名命名<br>）</p>



<h4>3.2 重启 rsyslog 服务</h4>



<p>（只在 rsyslog 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># systemctl restart rsyslog</code></pre>



<p>（<br>补充：<br>1) 使用 UDP 的 514 端口接收日志<br>2) 使用 TCP 的 514 端口接收日志<br>3) 需要在 3.1 修改 rsyslog 配置文件的案例中任选其一完成后在执行此步骤<br>）</p>



<h4>步骤四：配置 rsyslog 客户端<br>4.1 修改 rsyslog 客户端的案例</h4>



<p>（只在 rsyslog 客户端执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rsyslog.conf</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
*.emerg;*.alert;*.crit;*.err;*.warning;*.notice;*.info  @192.168.0.11</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code>......
*.emerg;*.alert;*.crit;*.err;*.warning;*.notice;*.info  @@192.168.0.11</code></pre>



<p>（<br>补充：<br>1) 这里的 192.168.0.11 是指 rsyslog 服务端的 IP 地址<br>2) IP 地址前一个 “@” 符后是指使用 UDP 端口 514 传输日志<br>3) IP 地址前两个 “@” 符后是指使用 TCP 端口 514 传输日志<br>）</p>



<h4>4.2 重启 rsyslog 服务</h4>



<p>（只在 rsyslog 客户端执行以下步骤）</p>



<pre class="wp-block-code"><code># systemctl restart rsyslog</code></pre>



<h4>步骤五：测试 rsyslog 服务<br>5.1 在 rsyslog 客户端上发送日志</h4>



<p>（只在 rsyslog 客户端执行以下步骤）</p>



<pre class="wp-block-code"><code># logger "This is our test log"</code></pre>



<p>（补充：这里以发送 This is our test log 信息为例）</p>



<h4>5.2 在 rsyslog 服务端上查看日志</h4>



<p>（只在 rsyslog 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># cat /var/log/* | grep test</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[命令] Linux 命令 iptables （设置防火墙日志）</title>
		<link>https://eternalcenter-2021-12.github.io/iptables-log/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Tue, 28 Jul 2020 07:01:45 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Firewall (系统防火墙)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Security Log (系统安全日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=10349</guid>

					<description><![CDATA[内容一：iptables 防火墙开启日志的案例1.1 案例一：让日志记录未匹配任何规则的 TCP 数据包，之后再将其丢弃的方法 在所有规则后面添加以下两条规则： （补充：这里以记录进来的数据并将 IPTABLES TCP IN: 作为前缀保存日志为例） 1.2 案例二：让日志记录未匹配任何规则的 UDP 数据包，之后再将其丢弃的方法 在所有规则后面添加以下两条规则： （补充：这里以记录进来的数据并将 IPTABLES TCP OUT: 作为前缀保存日志为例） 1.3 案例三：让日志记录未匹配任何规则的 ICMP 数据包，之后再将其丢弃的方法 在所有规则后面添加以下两条规则： （补充：这里以记录进来的数据并将 IPTABLES TCP ICMP: 作为前缀保存日志为例） 内容二：查看 iptables 防火墙日志的方法]]></description>
										<content:encoded><![CDATA[
<h4>内容一：iptables 防火墙开启日志的案例<br>1.1 案例一：让日志记录未匹配任何规则的 TCP 数据包，之后再将其丢弃的方法</h4>



<p>在所有规则后面添加以下两条规则：</p>



<pre class="wp-block-code"><code>......
# iptables -A INPUT -i -p tcp -j LOG --log-prefix "IPTABLES TCP IN: " 
# iptables -A INPUT -i -p tcp -j DROP</code></pre>



<p>（补充：这里以记录进来的数据并将 IPTABLES TCP IN: 作为前缀保存日志为例）</p>



<h4>1.2 案例二：让日志记录未匹配任何规则的 UDP 数据包，之后再将其丢弃的方法</h4>



<p>在所有规则后面添加以下两条规则：</p>



<pre class="wp-block-code"><code>...... 
# iptables -A INPUT -i -p tcp -j LOG --log-prefix "IPTABLES TCP OUT: " 
# iptables -A INPUT -i -p tcp -j DROP</code></pre>



<p>（补充：这里以记录进来的数据并将 IPTABLES TCP OUT: 作为前缀保存日志为例）</p>



<h4>1.3 案例三：让日志记录未匹配任何规则的 ICMP 数据包，之后再将其丢弃的方法</h4>



<p>在所有规则后面添加以下两条规则：</p>



<pre class="wp-block-code"><code>...... 
# iptables -A INPUT -i -p tcp -j LOG --log-prefix "IPTABLES TCP ICMP: " 
# iptables -A INPUT -i -p tcp -j DROP</code></pre>



<p>（补充：这里以记录进来的数据并将 IPTABLES TCP ICMP: 作为前缀保存日志为例）</p>



<h4>内容二：查看 iptables 防火墙日志的方法</h4>



<pre class="wp-block-code"><code># cat /log/var/message</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[内容] Linux SELinux 标签的设置</title>
		<link>https://eternalcenter-2021-12.github.io/selinux-label/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sat, 25 Jul 2020 07:11:03 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[SELinux]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System File Security (系统文件安全)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Process Security (系统进程安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Security Log (系统安全日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=10257</guid>

					<description><![CDATA[内容目录： 内容一：开启 SELinux 标签1.1 修改 SELinux 配置文件1.2 重启系统 内容二：SELinux 的常见特性2.1 SELinux 特性一：创建的文件或目录会自动继承其父目录的 SELinux 标签2.1.1 在 /var/www/html/ 目录下新创建 index.html 文件2.1.2 查看 /var/www/html/ 目录的 SELinux 标签2.1.3 查看新生成的 /var/www/html/index.html 标签2.2 SELinux 特性二：移动文件或目录和保留属性复制文件或目录不会改变其 SELinux 标签，普通复制会改变 SELinux 标签2.2.1 在 /tmp/ 目录下新创建 file1，file2，file3 文件2.2.2 查看 ls -Zd /tmp/ 目录的 SELinux 标签2.2.3 查看新创建文件的标签2.2.4 将 /tmp/file1 复制到 /var/www/html/2.2.5 将 /tmp/file2 移动到 /var/www/html/2.2.6 将 &#8230; <p class="link-more"><a href="https://eternalcenter-2021-12.github.io/selinux-label/" class="more-link">Continue reading<span class="screen-reader-text"> "[内容] Linux SELinux 标签的设置"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2>内容目录：</h2>



<h4>内容一：开启 SELinux 标签<br>1.1 修改 SELinux 配置文件<br>1.2 重启系统</h4>



<h4>内容二：SELinux 的常见特性<br>2.1 SELinux 特性一：创建的文件或目录会自动继承其父目录的 SELinux 标签<br>2.1.1 在 /var/www/html/ 目录下新创建 index.html 文件<br>2.1.2 查看 /var/www/html/ 目录的 SELinux 标签<br>2.1.3 查看新生成的 /var/www/html/index.html 标签<br>2.2 SELinux 特性二：移动文件或目录和保留属性复制文件或目录不会改变其 SELinux 标签，普通复制会改变 SELinux 标签<br>2.2.1 在 /tmp/ 目录下新创建 file1，file2，file3 文件<br>2.2.2 查看 ls -Zd /tmp/ 目录的 SELinux 标签<br>2.2.3 查看新创建文件的标签<br>2.2.4 将 /tmp/file1 复制到 /var/www/html/<br>2.2.5 将 /tmp/file2 移动到 /var/www/html/<br>2.2.6 将 /tmp/file2 复制到 /var/www/html/，并使用 -a 选项保留文件属性<br>2.2.7 查看这些文件的 SELinux 标签</h4>



<h4>内容三：查看某个文件或目录 SELinux 标签<br>3.1 查看某个文件 SELinux 标签<br>3.2 查看某个目录 SELinux 标签<br>3.3 查看某个进程 SELinux 标签</h4>



<h4>内容四：查看所有 SELinux 标签<br>4.1 查看所有文件和目录的 SELinux 标签<br>4.2 查看所有端口的 SELinux 标签<br>4.3 查看所有进程的 SELinux 标签</h4>



<h4>内容五：设置 SELinux 标签<br>5.1 设置文件和目录 SELinux 标签<br>5.1.1 使用 semanage fcontext 命令和 restorecon 命令设置文件和目录的 SELinux 标签<br>5.1.1.1 semanage fcontext 命令的常用选项<br>5.1.1.2 使用 semanage fcontext 命令和 restorecon 命令设置文件和目录的 SELinux 标签<br>5.1.1.2.1 使用 smanage fcontext 命令设置 SELinux 标签<br>5.1.1.2.2 使用 restorecon 命令修改默认上下文<br>5.1.2 使用 chcon 命令设置 SELinux 标签<br>5.2 设置端口 SELinux</h4>



<h2>具体的内容：</h2>



<h4>内容一：开启 SELinux 标签<br>1.1 修改 SELinux 配置文件</h4>



<pre class="wp-block-code"><code># vim /etc/selinux/config</code></pre>



<p>将以下内容：</p>



<pre class="wp-block-code"><code>......
SELINUX=disabled
......</code></pre>



<p>修改为：</p>



<pre class="wp-block-code"><code>......
SELINUX=enforcing
......</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code>......
SELINUX=perssive
......</code></pre>



<h4>1.2 重启系统</h4>



<pre class="wp-block-code"><code># reboot</code></pre>



<h4>内容二：SELinux 的常见特性<br>2.1 SELinux 特性一：创建的文件或目录会自动继承其父目录的 SELinux 标签<br>2.1.1 在 /var/www/html/ 目录下新创建 index.html 文件</h4>



<pre class="wp-block-code"><code># echo website &gt; /var/www/html/index.html</code></pre>



<p>（补充：这里以在 /var/www/html/ 目录下生成 index.html 文件为例）</p>



<h4>2.1.2 查看 /var/www/html/ 目录的 SELinux 标签</h4>



<pre class="wp-block-code"><code># ls -dZ /var/www/html/
unconfined_u:object_r:httpd_sys_content_t:s0 index.html</code></pre>



<h4>2.1.3 查看新生成的 /var/www/html/index.html 标签</h4>



<pre class="wp-block-code"><code># ls -Z /var/www/html/index.html/index.html 
unconfined_u:object_r:httpd_sys_content_t:s0 index.html</code></pre>



<p>（补充：从内容 1.1.2 和内容 1.1.3 命令的结果可以看出新生成的文件或其父目录的 SELinux 标签一致）</p>



<h4>2.2 SELinux 特性二：移动文件或目录和保留属性复制文件或目录不会改变其 SELinux 标签，普通复制会改变 SELinux 标签<br>2.2.1 在 /tmp/ 目录下新创建 file1，file2，file3 文件</h4>



<pre class="wp-block-code"><code># touch /tmp/file{1,2,3}</code></pre>



<h4>2.2.2 查看 ls -Zd /tmp/ 目录的 selinux 标签</h4>



<pre class="wp-block-code"><code># ls -Zd /tmp/
unconfined_u:object_r:user_tmp_t:s0 /tmp/</code></pre>



<h4>2.2.3 查看新创建文件的标签</h4>



<pre class="wp-block-code"><code># ls -Z /tmp/file*
unconfined_u:object_r:user_tmp_t:s0 /tmp/file1  unconfined_u:object_r:user_tmp_t:s0 /tmp/file2
unconfined_u:object_r:user_tmp_t:s0 /tmp/file3</code></pre>



<h4>2.2.4 将 /tmp/file1 复制到 /var/www/html/</h4>



<pre class="wp-block-code"><code># cp /tmp/file1 /var/www/html/</code></pre>



<h4>2.2.5 将 /tmp/file2 移动到 /var/www/html/</h4>



<pre class="wp-block-code"><code># mv /tmp/file2 /var/www/html/</code></pre>



<h4>2.2.6 将 /tmp/file2 复制到 /var/www/html/，并使用 -a 选项保留文件属性</h4>



<pre class="wp-block-code"><code># cp -a /tmp/file3 /var/www/html/</code></pre>



<h4>2.2.7 查看这些文件的 SELinux 标签</h4>



<pre class="wp-block-code"><code># ls -Z /var/www/html/file*
unconfined_u:object_r:httpd_sys_content_t:s0 file1           unconfined_u:object_r:user_tmp_t:s0 file3
unconfined_u:object_r:user_tmp_t:s0 file2</code></pre>



<p>（补充：从内容 2.2.3 和内容 2.2.7 命令的结果可以看出只有普通复制会改变 SELinux 标签 ）</p>



<h4>内容三：查看某个文件、目录或进程 SELinux 标签<br>3.1 查看某个文件 SELinux 标签</h4>



<pre class="wp-block-code"><code># ls -Z &lt;file&gt;</code></pre>



<h4>3.2 查看某个目录 SELinux 标签</h4>



<pre class="wp-block-code"><code># ls -Zd &lt;directory&gt;</code></pre>



<h4>3.3 查看某个进程 SELinux 标签</h4>



<pre class="wp-block-code"><code># ps -auxZ | grep &lt;process&gt;</code></pre>



<h4>内容四：查看所有 SELinux 标签<br>4.1 查看所有文件和目录的 SELinux 标签</h4>



<pre class="wp-block-code"><code># semanage fcontext -l</code></pre>



<p>（注意：需要单独安装 policycoreutils-python-utils 后才能使用 semanage 命令）</p>



<h4>4.2 查看所有端口的 SELinux 标签</h4>



<pre class="wp-block-code"><code># semanage port -l</code></pre>



<p>（注意：需要单独安装 policycoreutils-python-utils 后才能使用 semanage 命令）</p>



<h4>4.3 查看所有进程的 SELinux 标签</h4>



<pre class="wp-block-code"><code># ps -auxZ</code></pre>



<h4>内容五：设置 SELinux 标签<br>5.1 设置文件和目录 SELinux 标签<br>5.1.1 使用 semanage fcontext 命令和 restorecon 命令设置文件和目录的 SELinux 标签<br>5.1.1.1 semanage fcontext 命令的常用选项</h4>



<p>1) -a 添加或变更 SELinux 标签<br>2) -d 删除 SELinux 标签<br>3) -l 查看所有的 SELinux 标签<br>4) -t 指定上下文 SELinux 标签<br>5) -v 显示修改 SELinux 标签的内容<br>6) -R 递归设置 SELinux 标签<br>7) -m 变更 SELinux 标签</p>



<h4>5.1.1.2 使用 semanage fcontext 命令和 restorecon 命令设置文件和目录的 SELinux 标签<br>5.1.1.2.1 使用 smanage fcontext 命令设置 SELinux 标签</h4>



<pre class="wp-block-code"><code># semanage fcontext -a -t httpd_sys_content_t "/tmp(/.*)?"</code></pre>



<p>（补充：这里以将 /tmp(/.*) 的 SELinux 标签设置为 httpd_sys_content_t 为例）</p>



<p>（注意：需要单独安装 policycoreutils-python-utils 后才能使用 semanage 命令）</p>



<h4>5.1.1.2.2 使用 restorecon 命令修改默认上下文</h4>



<pre class="wp-block-code"><code># restorecon -Rv /tmp
Relabeled /tmp from unconfined_u:object_r:default_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0</code></pre>



<h4>5.1.2 使用 chcon 命令设置 SELinux 标签</h4>



<pre class="wp-block-code"><code># chcon -t httpd_sys_content_t /tmp/*</code></pre>



<p>（补充：这里以将 /tmp/* 的 SELinux 标签设置为 httpd_sys_content_t 为例）</p>



<h4>5.2 设置端口 SELinux</h4>



<pre class="wp-block-code"><code># semanage port -a -t http_port_t -p tcp 82</code></pre>



<p>（补充：这里以将 TCP 82 端口的 SELinux 标签设置为 http_port_t 为例）</p>



<p>（注意：需要单独安装 policycoreutils-python-utils 后才能使用 semanage 命令）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[模板] Linux 日志保存时间策略的配置模板 （logrotate 的配置模板）</title>
		<link>https://eternalcenter-2021-12.github.io/logrotate-template/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Mon, 20 Jul 2020 05:34:49 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System General Log (系统普通日志)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=10116</guid>

					<description><![CDATA[（补充：1) /etc/logrotate.d/messages 这个配置文件里的设置会影响到日志文件 /var/log/messages2) 在配置文件里添加 /var/log/secure 参数则代表会将 /var/log/secure 日志文件里的内容添加到 /var/log/messages 日志文件里3) 在配置文件里添加 delaycompress 参数则代表会将归档的日志进行压缩4) 在配置文件里添加 rotate 5 参数则代表只会保留最近的 5 次的日志压缩文件5) 在配置文件里添加 weekly 参数则代表每周会压缩一次日志文件6) 在配置文件里添加 create 755 root root 参数则代表日志文件的所属主和所属组都是 root，权限是 755）]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-code"><code># vim /etc/logrotate.d/messages
/var/log/messages
/var/log/secure
/var/log/maillog
{
    delaycompress
    nodateext
    rotate 5
    missingok
    notifempty
    weekly
    create 755 root root
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2&gt; /dev/null` 2&gt; /dev/null || true
    endscript
}</code></pre>



<p>（<br>补充：<br>1) /etc/logrotate.d/messages 这个配置文件里的设置会影响到日志文件 /var/log/messages<br>2) 在配置文件里添加 /var/log/secure 参数则代表会将 /var/log/secure 日志文件里的内容添加到 /var/log/messages 日志文件里<br>3) 在配置文件里添加 delaycompress 参数则代表会将归档的日志进行压缩<br>4) 在配置文件里添加 rotate 5 参数则代表只会保留最近的 5 次的日志压缩文件<br>5) 在配置文件里添加 weekly 参数则代表每周会压缩一次日志文件<br>6) 在配置文件里添加 create 755 root root 参数则代表日志文件的所属主和所属组都是 root，权限是 755<br>）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[内容] CentOS&#038;RHEL 日志记录的清除 （last ）</title>
		<link>https://eternalcenter-2021-12.github.io/last-record-clean-centosrhel/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Mon, 20 Jul 2020 03:00:30 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System General Log (系统普通日志)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Login Security (系统登录安全)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Security Log (系统安全日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=10095</guid>

					<description><![CDATA[步骤目录： 步骤一：查看原来的 last 记录 步骤二：清除原来的 last 记录2.1 确认原有 last 记录的日志文件2.2 将原有 last 记录的日志文件移走2.3 创建新的 last 记录的日志文件2.4 给新创建的 last 记录的日志文件对应的权限 步骤三：查看 last 记录有没有被成功清除 具体的操作步骤： 步骤一：查看原来的 last 记录 步骤二：清除原来的 last 记录2.1 确认原有 last 记录的日志文件 2.2 将原有 last 记录的日志文件移走 2.3 创建新的 last 记录的日志文件 2.4 给新创建的 last 记录的日志文件对应的权限 步骤三：查看 last 记录有没有被成功清除]]></description>
										<content:encoded><![CDATA[
<h2>步骤目录：</h2>



<h4>步骤一：查看原来的 last 记录</h4>



<h4>步骤二：清除原来的 last 记录<br>2.1 确认原有 last 记录的日志文件<br>2.2 将原有 last 记录的日志文件移走<br>2.3 创建新的 last 记录的日志文件<br>2.4 给新创建的 last 记录的日志文件对应的权限</h4>



<h4>步骤三：查看 last 记录有没有被成功清除</h4>



<h2>具体的操作步骤：</h2>



<h4>步骤一：查看原来的 last 记录</h4>



<pre class="wp-block-code"><code># last</code></pre>



<h4>步骤二：清除原来的 last 记录<br>2.1 确认原有 last 记录的日志文件</h4>



<pre class="wp-block-code"><code># ls -arlt /var/log/wtmp
-rw-rw-r--. 1 root utmp 294920 Jul 20 09:57 lastlog</code></pre>



<h4>2.2 将原有 last 记录的日志文件移走</h4>



<pre class="wp-block-code"><code># mv /var/log/wtmp /var/log/wtmp.backup</code></pre>



<h4>2.3 创建新的 last 记录的日志文件</h4>



<pre class="wp-block-code"><code># touch /var/log/wtmp</code></pre>



<h4>2.4 给新创建的 last 记录的日志文件对应的权限</h4>



<pre class="wp-block-code"><code># chown root:utmp /var/log/wtmp</code></pre>



<h4>步骤三：查看 last 记录有没有被成功清除</h4>



<pre class="wp-block-code"><code># last

wtmp begins Mon Jul 20 10:07:11 2020</code></pre>



<p></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[内容] Linux SELinux 布尔 （boolean） 值的设置</title>
		<link>https://eternalcenter-2021-12.github.io/selinux-boolean/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Thu, 16 Jul 2020 11:56:09 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[SELinux]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System File Security (系统文件安全)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Process Security (系统进程安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Security Log (系统安全日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=10063</guid>

					<description><![CDATA[内容目录： 内容一：开启 SELinux 布尔（boolean）值1.1 查看当前 SELinux 状态1.2 将 SELinux 的状态设置为 Enforcing 以开启布尔（boolean）值1.2.1 当当前 SELinux 的状态为 Disabled 时开启布尔（boolean）值的方法1.2.1.1 修改 SELinux 配置文件1.2.1.2 重启系统1.2.2 当当前 SELinux 的状态为 Perssive 时开启布尔（boolean）值的方法 内容二：查看所有 SELinux 布尔（boolean）值 内容三：布尔（boolean）值的管理3.1 允许某一个 SELinux 布尔（boolean）值开启3.1.1 临时允许某一个 SELinux 布尔（boolean）值开启3.1.1.1 临时允许某一个 SELinux 布尔（boolean）值开启的格式3.1.1.2 临时允许某一个 SELinux 布尔（boolean）值开启的案例3.1.2 永久允许某一个 SELinux 布尔（boolean）值开启3.1.2.1 永久允许某一个 SELinux 布尔（boolean）值开启的格式3.1.2.2 永久允许某一个 SELinux 布尔（boolean）值开启的案例3.2 取消某一个 SELinux 布尔（boolean）值开启3.2.1 临时取消某一个 &#8230; <p class="link-more"><a href="https://eternalcenter-2021-12.github.io/selinux-boolean/" class="more-link">Continue reading<span class="screen-reader-text"> "[内容] Linux SELinux 布尔 （boolean） 值的设置"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2>内容目录：</h2>



<h4>内容一：开启 SELinux 布尔（boolean）值<br>1.1 查看当前 SELinux 状态<br>1.2 将 SELinux 的状态设置为 Enforcing 以开启布尔（boolean）值<br>1.2.1 当当前 SELinux 的状态为 Disabled 时开启布尔（boolean）值的方法<br>1.2.1.1 修改 SELinux 配置文件<br>1.2.1.2 重启系统<br>1.2.2 当当前 SELinux 的状态为 Perssive 时开启布尔（boolean）值的方法</h4>



<h4>内容二：查看所有 SELinux 布尔（boolean）值</h4>



<h4>内容三：布尔（boolean）值的管理<br>3.1 允许某一个 SELinux 布尔（boolean）值开启<br>3.1.1 临时允许某一个 SELinux 布尔（boolean）值开启<br>3.1.1.1 临时允许某一个 SELinux 布尔（boolean）值开启的格式<br>3.1.1.2 临时允许某一个 SELinux 布尔（boolean）值开启的案例<br>3.1.2 永久允许某一个 SELinux 布尔（boolean）值开启<br>3.1.2.1 永久允许某一个 SELinux 布尔（boolean）值开启的格式<br>3.1.2.2 永久允许某一个 SELinux 布尔（boolean）值开启的案例<br>3.2 取消某一个 SELinux 布尔（boolean）值开启<br>3.2.1 临时取消某一个 SELinux 布尔（boolean）值开启<br>3.2.1.1 临时取消某一个 SELinux 布尔（boolean）值开启的格式<br>3.2.1.2 临时取消某一个 SELinux 布尔（boolean）值开启的案例<br>3.2.2 永久取消某一个 SELinux 布尔（boolean）值关闭<br>3.2.2.1 永久取消某一个 SELinux 布尔（boolean）值开启的格式<br>3.2.2.2 永久取消某一个 SELinux 布尔（boolean）值开启的案例</h4>



<h2>具体的操作步骤：</h2>



<h4>内容一：开启 SELinux 布尔（boolean）值<br>1.1 查看当前 SELinux 状态</h4>



<pre class="wp-block-code"><code># getenforce</code></pre>



<h4>1.2 将 SELinux 的状态设置为 Enforcing 以开启布尔（boolean）值<br>1.2.1 当当前 SELinux 的状态为 Disabled 时开启布尔（boolean）值的方法<br>1.2.1.1 修改 SELinux 配置文件</h4>



<pre class="wp-block-code"><code># vim /etc/selinux/config</code></pre>



<p>将以下内容：</p>



<pre class="wp-block-code"><code>......
SELINUX=disabled
......</code></pre>



<p>修改为：</p>



<pre class="wp-block-code"><code>......
SELINUX=enforcing
......</code></pre>



<h4>1.2.1.2 重启系统</h4>



<pre class="wp-block-code"><code># reboot</code></pre>



<h4>1.2.2 当当前 SELinux 的状态为 Perssive 时开启布尔（boolean）值的方法</h4>



<pre class="wp-block-code"><code># setenfoce 1</code></pre>



<p>（补充：系统重启后失效）</p>



<h4>内容二：查看所有 SELinux 布尔（boolean）值</h4>



<pre class="wp-block-code"><code># semanage boolean -l</code></pre>



<h4>内容三：布尔（boolean）值的管理<br>3.1 允许某一个 SELinux 布尔（boolean）值开启<br>3.1.1 临时允许某一个 SELinux 布尔（boolean）值开启<br>3.1.1.1 临时允许某一个 SELinux 布尔（boolean）值开启的格式</h4>



<pre class="wp-block-code"><code># setsebool &lt;boolean value> 1</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool &lt;boolean value> on</code></pre>



<h4>3.1.1.2 临时允许某一个 SELinux 布尔（boolean）值开启的案例</h4>



<pre class="wp-block-code"><code># setsebool httpd_can_network_connect 1</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool httpd_can_network_connect on</code></pre>



<h4>3.1.2 永久允许某一个 SELinux 布尔（boolean）值开启<br>3.1.2.1 永久允许某一个 SELinux 布尔（boolean）值开启的格式</h4>



<pre class="wp-block-code"><code># setsebool -P &lt;boolean value> 1</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool -P &lt;boolean value> on</code></pre>



<h4>3.1.2.2 永久允许某一个 SELinux 布尔（boolean）值开启的案例</h4>



<pre class="wp-block-code"><code># setsebool -P httpd_can_network_connect 1</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool -P httpd_can_network_connect on</code></pre>



<h4>3.2 取消某一个 SELinux 布尔（boolean）值开启<br>3.2.1 临时取消某一个 SELinux 布尔（boolean）值开启<br>3.2.1.1 临时取消某一个 SELinux 布尔（boolean）值开启的格式</h4>



<pre class="wp-block-code"><code># setsebool &lt;boolean value> 0</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool &lt;boolean value> off</code></pre>



<h4>3.2.1.2 临时取消某一个 SELinux 布尔（boolean）值开启的案例</h4>



<pre class="wp-block-code"><code># setsebool httpd_can_network_connect 0</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool httpd_can_network_connect off</code></pre>



<h4>3.2.2 永久取消某一个 SELinux 布尔（boolean）值关闭<br>3.2.2.1 永久取消某一个 SELinux 布尔（boolean）值开启的格式</h4>



<pre class="wp-block-code"><code># setsebool -P &lt;boolean value> 0</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool -P &lt;boolean value> off</code></pre>



<h4>3.2.2.2 永久取消某一个 SELinux 布尔（boolean）值开启的案例</h4>



<pre class="wp-block-code"><code># setsebool -P httpd_can_network_connect 0</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool -P httpd_can_network_connect off</code></pre>



<p></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[步骤] CentOS&#038;RHEL 网页图形化管理工具 cockpit</title>
		<link>https://eternalcenter-2021-12.github.io/cockpit/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sat, 06 Jun 2020 09:07:39 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Firewall (系统防火墙)]]></category>
		<category><![CDATA[System General Log (系统普通日志)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Login Security (系统登录安全)]]></category>
		<category><![CDATA[System Network (系统网络)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Operation (系统操作)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<category><![CDATA[System Performance (系统性能)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Process (系统进程)]]></category>
		<category><![CDATA[System Process & System Performance (系统进程 & 系统性能)]]></category>
		<category><![CDATA[System Process Security (系统进程安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Security Log (系统安全日志)]]></category>
		<category><![CDATA[System Setting (系统设置)]]></category>
		<category><![CDATA[System Software (系统软件)]]></category>
		<category><![CDATA[System Statistic Log (系统统计日志)]]></category>
		<category><![CDATA[System User (系统用户)]]></category>
		<category><![CDATA[System User & System Privilege (系统用户 & 系统权限)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=9718</guid>

					<description><![CDATA[步骤一：系统环境要求 服务器系统配置好可用的软件源 步骤二：安装 cockpit （补充：cockpit 是管理单台主机的程序，cockpit-dashaboard 是管理多台主机的程序） 步骤三：启动 cockpit 步骤四：登录 cockpit 使用浏览器登录：https://&/#60;服务器的 IP 地址&#62;:9090]]></description>
										<content:encoded><![CDATA[
<h4>步骤一：系统环境要求</h4>



<p>服务器系统配置好可用的软件源</p>



<h4>步骤二：安装 cockpit</h4>



<pre class="wp-block-code"><code># yum -y install cockpit cockpit-dashaboard</code></pre>



<p>（补充：cockpit 是管理单台主机的程序，cockpit-dashaboard 是管理多台主机的程序）</p>



<h4>步骤三：启动 cockpit</h4>



<pre class="wp-block-code"><code># systemctl start cockpit</code></pre>



<h4>步骤四：登录 cockpit</h4>



<p>使用浏览器登录：https://&lt;服务器的/ IP 地址&gt;:9090</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[命令] Linux 命令 history （历史命令查看和使用）</title>
		<link>https://eternalcenter-2021-12.github.io/history/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sat, 30 May 2020 06:04:00 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System General Log (系统普通日志)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Login Security (系统登录安全)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Operation (系统操作)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=9616</guid>

					<description><![CDATA[内容一：查看 Linux 历史命令1.1 查看 Linux 近期的历史命令 （注意：默认情况下 history 只会记录 1000 条历史命令） 1.2 查看 Linux 已归档的历史命令 内容二：使用 Linux 历史命令2.1 直接使用第 23 条历史命令 2.2 直接使用最近的一条以 h 开头的历史命令]]></description>
										<content:encoded><![CDATA[
<h4>内容一：查看 Linux 历史命令<br>1.1 查看 Linux 近期的历史命令</h4>



<pre class="wp-block-code"><code># histroy</code></pre>



<p>（注意：默认情况下 history 只会记录 1000 条历史命令）</p>



<h4>1.2 查看 Linux 已归档的历史命令</h4>



<pre class="wp-block-code"><code># cat ~/.bash_history</code></pre>



<h4>内容二：使用 Linux 历史命令<br>2.1 直接使用第 23 条历史命令</h4>



<pre class="wp-block-code"><code># !23</code></pre>



<h4>2.2 直接使用最近的一条以 h 开头的历史命令</h4>



<pre class="wp-block-code"><code># !h</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[步骤] Linux core dump 的开启 （临时）</title>
		<link>https://eternalcenter-2021-12.github.io/log-core/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Mon, 04 May 2020 05:51:05 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System General Log (系统普通日志)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<category><![CDATA[System Setting (系统设置)]]></category>
		<category><![CDATA[System Software (系统软件)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=8923</guid>

					<description><![CDATA[步骤一：理解 core dump 的作用 开启 core dump 之后，如果出现了 C 语言程序的 crash，则会将 crash 的结果记录到一个文件里 步骤二：临时开启 core dump2.1 设置可生成 core dump 大小的参数2.1.1 查看当前允许生成 core dump 的大小 2.1.2 将允许生成 core dump 大小的参数设置为无限大 2.1.3 确认修改结果 2.2 设置 core dump 生成的位置 步骤三：此时如果有 C 语言的程序 crash 了，则会被自动记录]]></description>
										<content:encoded><![CDATA[
<h4>步骤一：理解 core dump 的作用</h4>



<p>开启 core dump 之后，如果出现了 C 语言程序的 crash，则会将 crash 的结果记录到一个文件里</p>



<h4>步骤二：临时开启 core dump<br>2.1 设置可生成 core dump 大小的参数<br>2.1.1 查看当前允许生成 core dump 的大小</h4>



<pre class="wp-block-code"><code># ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31722
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31722
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited</code></pre>



<h4>2.1.2 将允许生成 core dump 大小的参数设置为无限大</h4>



<pre class="wp-block-code"><code># ulimit -c unlimited</code></pre>



<h4>2.1.3 确认修改结果</h4>



<pre class="wp-block-code"><code># ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31722
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31722
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited</code></pre>



<h4>2.2 设置 core dump 生成的位置</h4>



<pre class="wp-block-code"><code># sysctl -w kernel.core_pattern=/tmp/corefile/core-%e-%p</code></pre>



<h4>步骤三：此时如果有 C 语言的程序 crash 了，则会被自动记录</h4>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[命令] Linux 命令 last （审计）</title>
		<link>https://eternalcenter-2021-12.github.io/last/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sat, 26 Oct 2019 14:37:05 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Login Security (系统登录安全)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Security Log (系统安全日志)]]></category>
		<category><![CDATA[System User (系统用户)]]></category>
		<category><![CDATA[System User & System Privilege (系统用户 & 系统权限)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=6358</guid>

					<description><![CDATA[案例一：只显示最近的 10 条记录 或者： 案例二：指定 btmp 为查询文件 案例三：将 IP 地址转换为主机 案例四：显示 2019 年 10 月 10 日之前的 10 条记录 案例五：显示最后一次重启的时间 或者： 案例六：显示最后一次关机的时间 案例七：显示系统运行等级的变化 （补充：这里 -x 的作用是把系统运行等级的改变也输出出来）]]></description>
										<content:encoded><![CDATA[
<h4>案例一：只显示最近的 10 条记录</h4>



<pre class="wp-block-code"><code># last -n 10</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># last -10</code></pre>



<h4>案例二：指定 btmp 为查询文件</h4>



<pre class="wp-block-code"><code># last -10 -f /var/log/btmp</code></pre>



<h4>案例三：将 IP 地址转换为主机</h4>



<pre class="wp-block-code"><code># last -10 -d</code></pre>



<h4>案例四：显示 2019 年 10 月 10 日之前的 10 条记录</h4>



<pre class="wp-block-code"><code># last -10 -t 201910100000</code></pre>



<h4>案例五：显示最后一次重启的时间</h4>



<pre class="wp-block-code"><code># last | grep reboot | head -1</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># last reboot | head -1</code></pre>



<h4>案例六：显示最后一次关机的时间</h4>



<pre class="wp-block-code"><code># last | grep -i shutdown | head -1</code></pre>



<h4>案例七：显示系统运行等级的变化</h4>



<pre class="wp-block-code"><code># last -x | grep runlevel</code></pre>



<p>（补充：这里 -x 的作用是把系统运行等级的改变也输出出来）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[内容] Linux 日志消息优先级简介</title>
		<link>https://eternalcenter-2021-12.github.io/log-level/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Tue, 15 Oct 2019 07:36:48 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System General Log (系统普通日志)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=5892</guid>

					<description><![CDATA[内容一：系统日志的存放路径 内容二：查看系统对应优先级的日志的方法 内容三：日志消息的优先级 序号 关键字 优先级 内容 1 EMERG 级别 0 紧急，系统本身已经无法再运行必须马上拯救 2 ALERT 级别 1 警报，系统出现了重大错误必须马上处理的情况 3 CRIT 级别 2 严重，系统出现了严重的情况 4 ERROR 级别 3 错误，系统出现了错误的情况 5 WARNING 级别 4 警告，系统出现了需要警告的情况 6 NOTICE 级别 5 注意，系统出现了需要注意的情况 7 INFO 级别 6 信息，系统出现了一些情况 8 DEBUG 级别 7 调试，系统出现了程序或服务调试的情况 （注意：优先级是按照从紧急到无所谓的顺序进行排列的）]]></description>
										<content:encoded><![CDATA[
<h4>内容一：系统日志的存放路径</h4>



<pre class="wp-block-code"><code>/var/log/messages</code></pre>



<h4>内容二：查看系统对应优先级的日志的方法</h4>



<pre class="wp-block-code"><code># grep -i &lt;priority&gt; /var/log/messages</code></pre>



<h4>内容三：日志消息的优先级</h4>



<figure class="wp-block-table"><table><tbody><tr><td class="has-text-align-center" data-align="center"><strong>序号</strong></td><td><strong>关键字</strong></td><td><strong>优先级</strong></td><td><strong>内容</strong></td></tr><tr><td class="has-text-align-center" data-align="center">1</td><td> EMERG</td><td> 级别 0</td><td> 紧急，系统本身已经无法再运行必须马上拯救</td></tr><tr><td class="has-text-align-center" data-align="center">2</td><td> ALERT</td><td> 级别 1</td><td> 警报，系统出现了重大错误必须马上处理的情况</td></tr><tr><td class="has-text-align-center" data-align="center">3</td><td> CRIT</td><td> 级别 2</td><td> 严重，系统出现了严重的情况</td></tr><tr><td class="has-text-align-center" data-align="center">4</td><td> ERROR</td><td>级别 3</td><td> 错误，系统出现了错误的情况</td></tr><tr><td class="has-text-align-center" data-align="center">5</td><td> WARNING</td><td>级别 4</td><td> 警告，系统出现了需要警告的情况</td></tr><tr><td class="has-text-align-center" data-align="center">6</td><td> NOTICE</td><td>级别 5</td><td> 注意，系统出现了需要注意的情况</td></tr><tr><td class="has-text-align-center" data-align="center">7</td><td> INFO</td><td>级别 6</td><td> 信息，系统出现了一些情况</td></tr><tr><td class="has-text-align-center" data-align="center">8</td><td> DEBUG</td><td>级别 7</td><td> 调试，系统出现了程序或服务调试的情况</td></tr></tbody></table></figure>



<p>（注意：优先级是按照从紧急到无所谓的顺序进行排列的）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[命令] Linux 命令 journalctl （查看日志）</title>
		<link>https://eternalcenter-2021-12.github.io/journalctl/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sat, 24 Aug 2019 15:11:14 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System General Log (系统普通日志)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-2021-12.github.io/?p=5513</guid>

					<description><![CDATA[内容目录： 内容一：journalctl 日志工具的常用用法1.1 查看包含某一个服务名的关键字的日志1.2 查看某一个服务某一个优先级的日志1.3 查看某一个编号的日志1.4 查看从某一个日期开始到某一个日期结束的日志 内容二：journalctl 日志工具的使用案例2.1 案例一：列出最近 5 条重要程度在 ERR 及以上的日志信息2.2 案例二：列出所有与服务 httpd 相关的日志信息2.3 案例三：列出前 5 个小时内的日志信息2.4 案例四：在紧急模式下查看系统日志 具体的内容： 内容一：journalctl 日志工具的常用用法1.1 查看包含某一个服务名的关键字的日志 1.2 查看某一个服务某一个优先级的日志 1.3 查看某一个编号的日志 1.4 查看从某一个日期开始到某一个日期结束的日志 内容二：journalctl 日志工具的使用案例2.1 案例一：列出最近 5 条重要程度在 ERR 及以上的日志信息 2.2 案例二：列出所有与服务 httpd 相关的日志信息 2.3 案例三：列出前 5 个小时内的日志信息 2.4 案例四：在紧急模式下查看系统日志]]></description>
										<content:encoded><![CDATA[
<h2>内容目录：</h2>



<h4>内容一：journalctl 日志工具的常用用法<br>1.1 查看包含某一个服务名的关键字的日志<br>1.2 查看某一个服务某一个优先级的日志<br>1.3 查看某一个编号的日志<br>1.4 查看从某一个日期开始到某一个日期结束的日志</h4>



<h4>内容二：journalctl 日志工具的使用案例<br>2.1 案例一：列出最近 5 条重要程度在 ERR 及以上的日志信息<br>2.2 案例二：列出所有与服务 httpd 相关的日志信息<br>2.3 案例三：列出前 5 个小时内的日志信息<br>2.4 案例四：在紧急模式下查看系统日志</h4>



<h2>具体的内容：</h2>



<h4>内容一：journalctl 日志工具的常用用法<br>1.1 查看包含某一个服务名的关键字的日志</h4>



<pre class="wp-block-code"><code># journalctl | grep &lt;server name keywords></code></pre>



<h4>1.2 查看某一个服务某一个优先级的日志</h4>



<pre class="wp-block-code"><code># journalctl -u &lt;service> -p &lt;priority></code></pre>



<h4>1.3 查看某一个编号的日志</h4>



<pre class="wp-block-code"><code># journalctl -n &lt;number of messages></code></pre>



<h4>1.4 查看从某一个日期开始到某一个日期结束的日志</h4>



<pre class="wp-block-code"><code># journalctl --since="&lt;yyyy-mm-dd> &lt;HH:MM:SS>" --until="&lt;yyyy-mm-dd> &lt;HH:MM:SS>"</code></pre>



<h4>内容二：journalctl 日志工具的使用案例<br>2.1 案例一：列出最近 5 条重要程度在 ERR 及以上的日志信息</h4>



<pre class="wp-block-code"><code># journalctl -p err -n 5</code></pre>



<h4>2.2 案例二：列出所有与服务 httpd 相关的日志信息</h4>



<pre class="wp-block-code"><code># journalctl -u httpd</code></pre>



<h4>2.3 案例三：列出前 5 个小时内的日志信息</h4>



<pre class="wp-block-code"><code># journalctl --since "2019-05-01 14:00" --until "2019-05-01 19:00"</code></pre>



<h4>2.4 案例四：在紧急模式下查看系统日志</h4>



<pre class="wp-block-code"><code># journalctl -xb</code></pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
