易陆发现互联网技术论坛

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

systemd: Started Session *** of user root

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

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

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

x
系统message日志无故报 systemd: Started Session :
( z( @/ Q4 M" P% r2 r7 _Oct 20 09:01:19 controller2 systemd: Started Session 108 of user root.
8 P+ j/ x6 H- i' `8 ^Oct 20 09:10:01 controller2 systemd: Started Session 110 of user root.
7 K4 w3 r* s. w) E! N) `9 C* {Oct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.0 p( @- r1 k4 R2 v/ t% P* R
Oct 20 09:12:29 controller2 systemd: Started Session 111 of user root.
. _  I. z  F  U! A5 _^C& E7 |* p* R/ S2 s( `) [
[root@controller2 ~]#  X- j* d- C* \. D
' D- K0 l/ Q4 s8 C) T
解决办法:添加syslog配置 : D1 g8 u* Q5 q$ X. T) t$ x5 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. \1 }5 k' |  g$ G
[root@controller2 ~]#  ) M' j2 I2 O9 k8 T0 i- _
[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# N2 J# O& e8 Y. v; q4 C4 d
7 ^1 n$ T  y$ b9 V0 U3 ^3 V' d
. z7 n& D0 ?' n) _: j
[root@controller2 ~]# tail -f /var/log/messages
: t4 U4 h$ b3 r$ OOct 20 08:10:01 controller2 systemd: Started Session 102 of user root.
4 x" i7 m* t' W' \Oct 20 08:20:01 controller2 systemd: Started Session 103 of user root.5 F' w9 i( Z, n$ Y6 L( Q, k
Oct 20 08:30:01 controller2 systemd: Started Session 104 of user root./ F9 t5 v/ ^9 H' \. ~& \+ A" m; q
Oct 20 08:40:01 controller2 systemd: Started Session 105 of user root.
+ ]8 N; q: X+ ]$ bOct 20 08:50:01 controller2 systemd: Started Session 106 of user root.# i! L2 o' d2 [) ?: L" u
Oct 20 09:00:01 controller2 systemd: Started Session 107 of user root./ j3 a3 W2 g  Y- K. w* ~
Oct 20 09:01:19 controller2 systemd: Started Session 108 of user root.* ?2 Z7 b( A' Q
Oct 20 09:10:01 controller2 systemd: Started Session 110 of user root.! }3 ^6 Z) A0 `
Oct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.
8 F9 H8 t+ F7 C9 f; H+ q$ {Oct 20 09:12:29 controller2 systemd: Started Session 111 of user root./ [9 A% P" Q; P. f6 o5 z& F
5 A  A1 J' N, }
: v6 x7 Z" J- g( h: U
重启syslog2 V6 A) D7 p4 l4 l
^C" X! F7 v/ r& I& i) k
[root@controller2 ~]# systemctl restart rsyslog  C* z. G+ B% p# F7 O% A- K

& T' a9 b4 o9 w9 _1 i6 b( f4 B( a6 k$ b6 N+ J+ ]
[root@controller2 ~]# tail -f /var/log/messages
8 n- D. {' F  }Oct 20 09:01:19 controller2 systemd: Started Session 108 of user root.7 ]* r9 `) h/ y- O* B" Q
Oct 20 09:10:01 controller2 systemd: Started Session 110 of user root.8 Z4 M3 K6 |  v) ^1 }$ b
Oct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.
7 p( D7 r$ f6 \Oct 20 09:12:29 controller2 systemd: Started Session 111 of user root.
4 g6 `8 u2 n2 L9 hOct 20 09:15:11 controller2 systemd: Stopping System Logging Service...
2 q+ _( a$ S1 T# ~Oct 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.$ l! h7 j8 F9 Q
Oct 20 09:15:11 controller2 systemd: Stopped System Logging Service.) d0 ]& N( k# G; D
Oct 20 09:15:11 controller2 systemd: Starting System Logging Service...6 s. u8 Y2 m3 [! Z  d
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$ a; S" l4 H& G& k$ f
Oct 20 09:15:11 controller2 systemd: Started System Logging Service.+ K& b5 b5 Q% \" k8 z
) P4 E9 i. s1 Q+ A% S- S5 e& d$ r
暂未报错:
+ |# }! z& w3 l( w4 }- T
 楼主| 发表于 2021-10-20 09:30:50 | 显示全部楼层
  手动修改配置文件:
6 [. \) U8 ?1 k. {% P! M( Y0 k; @) f; I  J7 y  E1 ?" E4 L
将/etc/systemd/system.conf 中 LogLevel=info 设置成如下:
" C: F) m1 e. o4 f. ?0 \8 } 7 l) |! g" B; K) L) F- K# x3 `, z
#LogLevel=info, l0 h( F1 A1 E5 D; D" u: j1 ~1 m" L
LogLevel=notice5 P% X% Y( B3 p1 V4 ?
' L  V6 P2 d) F' Q1 }, E5 V. c+ t
方法三:
1 M- n2 d$ d. F( L0 h, ?4 V通过系统命令,修改日志配置文件:
- k; C# R2 h+ K- j1 _8 jsystemd-analyze set-log-level notice6 u. l- A) M/ T! v/ n3 i
( {, n3 c0 y0 }' c9 T
三、Linux服务器的日志管理
: Q6 l6 i4 I( k/ \0 h1 L* o: k& N消息紧急程度排行:
/ F! ?: b; E9 @emerg:该系统不可用& R( S  b- X- s4 j8 z" f1 y; {
alert:需要立即修改* ?. e+ y) l5 f$ i# \' R0 O! e
crit:紧急情况
( D, g: t% x3 M, T+ V2 Terr:错误信息) |  J% H" J; T) D  [; }
warning:预警信息
7 J/ B, c4 b: C  A& L* r6 T. l! @notice:具有重要性的普通条件
$ L% \) z; d4 ninfo:提供信息的消息9 o) ~  i2 g# X9 Y, Y
debug:不包含函数条件或问题的其他信息
, r1 W1 o' t7 Q% d; M6 xnone:没有重要级,通常用于排错
+ r& C; n5 z. ~4 P. M& C! E1 F5 Z
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 23:55 , Processed in 0.064523 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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