将设为首页浏览此站
开启辅助访问 天气与日历 收藏本站联系我们切换到窄版

易陆发现论坛

 找回密码
 开始注册
查看: 197|回复: 1
收起左侧

systemd: Started Session *** of user root

[复制链接]
发表于 2021-10-20 09:26:09 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?开始注册

x
系统message日志无故报 systemd: Started Session :
0 E% w! c3 ]) Z2 SOct 20 09:01:19 controller2 systemd: Started Session 108 of user root.  _/ q3 n/ j, G
Oct 20 09:10:01 controller2 systemd: Started Session 110 of user root.
+ r' |4 y- l; ]Oct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.
7 ~# n+ [6 e' x- J1 G% c' f. lOct 20 09:12:29 controller2 systemd: Started Session 111 of user root.
$ c4 a6 L. ^& S. P# U^C+ `8 J( y" {, K4 G  J2 ^
[root@controller2 ~]#4 [' h3 V* Y, R5 ]2 U2 i
+ {* P+ A. W' s) Q: t7 \
解决办法:添加syslog配置
5 n" `  Y  q% O8 f4 ~/ T[root@controller2 ~]# echo 'if $programname == "systemd" and ($msg contains "Starting Session" or $msg contains "Started Session" or $msg contains "Created slice" or $msg contains "Starting user-" or $msg contains "Starting User Slice of" or $msg contains "Removed session" or $msg contains "Removed slice User Slice of" or $msg contains "Stopping User Slice of") then stop' >/etc/rsyslog.d/ignore-systemd-session-slice.conf
* s$ [, H' e$ b( W& \[root@controller2 ~]#  3 _6 [( g  x" Y; m+ T, N; ]( `  a
[root@controller2 ~]# echo 'if $programname == "systemd" and ($msg contains "Starting Session" or $msg contains "Started Session" or $msg contains "Created slice" or $msg contains "Starting user-" or $msg contains "Starting User Slice of" or $msg contains "Removed session" or $msg contains "Removed slice User Slice of" or $msg contains "Stopping User Slice of") then stop' >/etc/rsyslog.d/ignore-systemd-session-slice.conf
6 A( }5 j7 w" h( |0 [2 P8 C7 t2 D4 [% H! z  {
( q6 O' H- W0 Q) z9 g& x3 v, j7 a
[root@controller2 ~]# tail -f /var/log/messages
8 Y4 T1 h" e, u3 `; l3 YOct 20 08:10:01 controller2 systemd: Started Session 102 of user root.
( ]* y: @- V% s" FOct 20 08:20:01 controller2 systemd: Started Session 103 of user root.
& O+ x8 Y* @5 dOct 20 08:30:01 controller2 systemd: Started Session 104 of user root.
$ o( z# J. Y- Z4 U" J( r- O1 lOct 20 08:40:01 controller2 systemd: Started Session 105 of user root.
4 q  J. w1 @" BOct 20 08:50:01 controller2 systemd: Started Session 106 of user root./ i1 ^# z% ~& z* b  o$ g
Oct 20 09:00:01 controller2 systemd: Started Session 107 of user root.) `( j" L+ U5 N/ z' `
Oct 20 09:01:19 controller2 systemd: Started Session 108 of user root.
- Y9 l7 `# A1 \Oct 20 09:10:01 controller2 systemd: Started Session 110 of user root.
) b/ {: W- b' n! O% d6 NOct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.
) Z/ T5 G/ t5 h1 f. n3 _5 sOct 20 09:12:29 controller2 systemd: Started Session 111 of user root.1 g* ]. M0 \1 f! [, _/ {! |/ b
7 ^: ?2 {+ T$ N9 C7 s3 x
/ d: ?% Y; a, n4 H! n6 V5 x- a
重启syslog  d1 ~: V4 a/ \4 s
^C
$ Y- [  A' ^$ s5 l[root@controller2 ~]# systemctl restart rsyslog
0 q0 B$ @7 F5 \$ K! h9 p7 I
* Y3 z8 ^% p, I
$ ]! A9 {/ m9 y+ g0 `* w8 W[root@controller2 ~]# tail -f /var/log/messages) [" {0 _% n3 i7 ?/ ~- d! m) \2 u
Oct 20 09:01:19 controller2 systemd: Started Session 108 of user root.9 V4 V7 C  l" Y9 ^5 [* B% O
Oct 20 09:10:01 controller2 systemd: Started Session 110 of user root.
  _. `3 P( r9 @: }# G1 |: j) {Oct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.( K( d1 h& S1 t
Oct 20 09:12:29 controller2 systemd: Started Session 111 of user root.2 s% X3 p3 \9 f  F5 A. r' ]
Oct 20 09:15:11 controller2 systemd: Stopping System Logging Service...
4 R# i5 s" J* l# {' ?5 Q; G$ d, YOct 20 09:15:11 controller2 rsyslogd: [origin software="rsyslogd" swVersion="8.24.0-55.el7" x-pid="1072" x-info="http://www.rsyslog.com"] exiting on signal 15.
3 L: U: _& r1 e: F8 KOct 20 09:15:11 controller2 systemd: Stopped System Logging Service.; ~% _' G( T3 E0 @: Y5 e
Oct 20 09:15:11 controller2 systemd: Starting System Logging Service...5 @9 ]0 j! s. @+ @/ b7 Y7 o
Oct 20 09:15:11 controller2 rsyslogd: [origin software="rsyslogd" swVersion="8.24.0-55.el7" x-pid="221370" x-info="http://www.rsyslog.com"] start
, Q& N* H! c7 W/ KOct 20 09:15:11 controller2 systemd: Started System Logging Service.
6 Y7 k+ ?  ]5 ]8 I, N
" w' L( o+ `% @' u暂未报错:+ h' c# a+ p9 |0 m
 楼主| 发表于 2021-10-20 09:30:50 | 显示全部楼层
  手动修改配置文件:3 Y7 ?( j6 i/ W9 Q7 |; @1 p4 h

7 {0 u7 {6 Z! q8 y: u7 f7 w将/etc/systemd/system.conf 中 LogLevel=info 设置成如下:
& t+ e2 x$ @8 k6 ^+ c2 r/ J
5 p( ?7 }4 F+ F% I! d# O1 K#LogLevel=info0 S# o: R! P( k& ~; t
LogLevel=notice
% |9 N" l8 U) Q, q2 ?  [" W5 r( G) r4 E' A2 x' R
方法三:
. J5 U% F4 A- ]5 b1 y通过系统命令,修改日志配置文件:( b- ~7 j% D' E3 \7 n" g6 q, ^( ~
systemd-analyze set-log-level notice) R) _4 M5 Z% Q  A! q

0 [+ E2 j0 `4 X9 y$ F" B$ V三、Linux服务器的日志管理
7 H3 D# G. r* d2 `. p! W9 N; N消息紧急程度排行:
3 A2 T5 ?+ {0 j! A, D: [$ aemerg:该系统不可用
8 ?* f- r' [( o" |: Y) C, {  o# F! _! galert:需要立即修改! A$ q5 f) J  G! H6 a
crit:紧急情况5 s. p( A( Z' d+ U  M
err:错误信息
# F3 z1 t3 q/ |5 e7 Z4 U. Xwarning:预警信息
4 Y- n! t  ^: }( y( k- z/ l9 N9 ?notice:具有重要性的普通条件  c$ C8 m2 e: i) F" K( U
info:提供信息的消息# L# X2 e* L* D+ j4 U
debug:不包含函数条件或问题的其他信息- }# H% L% X) c+ N/ a; S" J
none:没有重要级,通常用于排错
5 h5 X+ B: }" A* ?& u
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

如有购买积分卡请联系497906712

QQ|返回首页|Archiver|手机版|小黑屋|易陆发现 点击这里给我发消息

GMT+8, 2021-11-28 19:50 , Processed in 0.042996 second(s), 23 queries .

Powered by LR.LINUX.cloud bbs168x X3.2 Licensed

© 2012-2022 Comsenz Inc.

快速回复 返回顶部 返回列表