centos8 过滤 syslog信息

服务器(centos8)在用户登录的时候会出现一些登录日志。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 example.com systemd[1]: Started /run/user/0 mount wrapper. example.com systemd[1]: Created slice User Slice of UID 0. example.com systemd[1]: Starting User Manager for UID 0... example.com systemd[1]: Started Session 51 of user root. example.com systemd[20871]: Starting D-Bus User Message Bus Socket. example.com systemd[20871]: Reached target Timers. example.com systemd[20871]: Reached target Paths. example.com systemd[20871]: Listening on D-Bus User Message Bus Socket. example.com systemd[20871]: Reached target Sockets. example.com systemd[20871]: Reached target Basic System. example.com systemd[20871]: Reached target Default. example.com systemd[20871]: Startup finished in 51ms. example.com systemd[1]: Started User Manager for UID 0. example.com systemd[1]: session-51.scope: Succeeded. example.com systemd[1]: Stopping User Manager for UID 0... example.com systemd[20871]: Stopped target Default. example.com systemd[20871]: Stopped target Basic System. example.com systemd[20871]: Stopped target Sockets. example.com systemd[20871]: Stopped target Paths. example.com systemd[20871]: dbus.socket: Succeeded. example.com systemd[20871]: Closed D-Bus User Message Bus Socket. example.com systemd[20871]: Reached target Shutdown. example.com systemd[20871]: Starting Exit the Session... example.com systemd[20871]: Stopped target Timers. example.com systemd[1]: user@0.service: Killing process 20967 (systemctl) with signal SIGKILL. example.com systemd[1]: user@0.service: Succeeded. example.com systemd[1]: Stopped User Manager for UID 0. example.com systemd[1]: Stopping /run/user/0 mount wrapper... example.com systemd[1]: Removed slice User Slice of UID 0. example.com systemd[1]: run-user-0.mount: Succeeded. example.com systemd[1]: user-runtime-dir@0.service: Succeeded. example.com systemd[1]: Stopped /run/user/0 mount wrapper. 通过下面命令生成rsyslog的过滤规则; 1 2 3 4 5 6 7 8 9 10 echo 'if $programname == "systemd" and ($msg contains "Started /run/$msg" or $msg contains "Starting Session" or $msg contains "Started Session" or $msg contains "Created slice User" or $msg contains "Starting User Manager" or $msg contains "Starting User" or $msg contains "Starting D-Bus" or $msg contains "Reached target" or $msg contains "Listening on D-Bus" or $msg contains "Startup finished" or $msg contains "session-" or $msg contains "Stopping User Manager" or $msg contains "Stopped target" or $msg contain "dbus.socket" or $msg contains "Stopped target " or $msg contains "Removed session" or $msg contains "Removed slice User Slice of" or $msg contains "Stopped /run/user" or $msg contains "Stopped User Manager" or $msg contains "Stopping User Slice of" ) then stop' >/etc/rsyslog.d/ignore-systemd-session-slice.conf 根据实际情况, 新增相关过滤规则即可 ...

2022-01-02 · 1 min · 468 words · Garlic Space

C++ pointers 和reference

Pointer 和 references 主要区别 reference:总代表一个对象, 没有null reference;pointer则没有限制,可以为null poiner可以被重新赋值; reference不可以被重新赋值。 应用场景 如果在不同时间指向不同对象则使用pointer, 如果一旦代表该对象就不能改变选择reference. ...

2021-10-25 · 2 min · 702 words · Garlic Space

What every programmer should know about memory,Part 1

这篇文章 What every programmer should know about memory, Part 1 是出自lwn.net 作者 Ulrich Drepper 总线结构 常见的商用计算机结构: 北桥南桥结构: CPU通过FSB连接到北桥, 北桥包含内存控制器,通过不同内存控制器链接不同的RAM,如DRAM,SDRAM, Rambus,南桥主要连接I/O设备,支持不同总线接口如:PCI,SATA,USB。 ...

2021-10-16 · 4 min · 1553 words · Garlic Space

ACME 证书自动化管理

在搭建blog使用https服务,需要申请配置一个域名证书,使用了Let’s Encrypt申请了免费的https证书。

2021-08-28 · 4 min · 1927 words · Garlic Space

docker 安装 Wordpress 及更新

今天登录到博客提示需要升级php,更新了下镜像顺便把之前搭建的步骤整理了一下。

2021-08-24 · 1 min · 501 words · Garlic Space

leetcode - Squares of a Sorted Array

Given an integer array nums sorted in non-decreasing order, return _an array of the squares of each number sorted in non-decreasing order

2021-06-11 · 1 min · 382 words · Garlic Space

Leetcode-Is Subsequence

Given two strings s and t, check if s is a subsequence of t

2021-05-18 · 1 min · 307 words · Garlic Space

DeFi

DeFi:Decentralized finance 是一种基于block-chain的金融形式。他不依赖于券商,银行,交易所等中心话的机构。

2021-05-12 · 3 min · 1036 words · Garlic Space

LeetCode-3Sum

Given an integer array nums, return all the triplets numsi, numsj, numsk such that i != j, i != k, and j != k, and numsi + numsj + numsk == 0

2021-05-10 · 1 min · 455 words · Garlic Space

LeetCode-Two Sum

Given an array of integers nums and an integer target, return _indices of the two numbers such that they add up to target

2021-05-10 · 1 min · 369 words · Garlic Space