找回密码
 注册
查看: 1485|回复: 1

systemd: Started Session *** of user root

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2021-10-20 09:26:09 | 显示全部楼层 |阅读模式
系统message日志无故报 systemd: Started Session :
9 _/ t) N# l- y- o( T4 u: i1 BOct 20 09:01:19 controller2 systemd: Started Session 108 of user root." N+ K3 y, \4 Y8 v+ b! [+ [
Oct 20 09:10:01 controller2 systemd: Started Session 110 of user root.
3 d" ^' K* a$ Q: c( \; ?Oct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.: s% ^# C. }. v$ A( S
Oct 20 09:12:29 controller2 systemd: Started Session 111 of user root.! V6 a1 V+ M2 n; ?) P
^C
, x# b! c* v2 d) t[root@controller2 ~]#) @$ y1 Q5 V/ N% M

( t1 ~9 D" V" v5 }# ?( C( Z0 v6 W- ^; p解决办法:添加syslog配置 9 \( b- i: u8 P% w) d
[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- w- x7 D% @% G" ?" L6 x0 R
[root@controller2 ~]#  2 t  I3 q: [. U" C$ ^
[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  ]* p+ }( v  K& D! D: y$ Q( O1 U
. O% n6 I/ {$ h" i  ~$ S
& i1 V1 i; n1 d' [! P2 z( R
[root@controller2 ~]# tail -f /var/log/messages
3 \9 ?- F; w) [# w7 eOct 20 08:10:01 controller2 systemd: Started Session 102 of user root.
% M/ [3 ~1 |1 T. X* QOct 20 08:20:01 controller2 systemd: Started Session 103 of user root.7 C: B- a+ n7 E
Oct 20 08:30:01 controller2 systemd: Started Session 104 of user root.
: ?6 y1 e& i! c: t1 h/ U" b" KOct 20 08:40:01 controller2 systemd: Started Session 105 of user root.2 O2 ^- j1 N( m1 K2 I: c, L3 O
Oct 20 08:50:01 controller2 systemd: Started Session 106 of user root.
0 ?- y1 \; O1 J* XOct 20 09:00:01 controller2 systemd: Started Session 107 of user root.
1 I3 N2 }, T& q% y5 a% ROct 20 09:01:19 controller2 systemd: Started Session 108 of user root.
% {$ Z& h! p- ]# U4 I& u' P; \Oct 20 09:10:01 controller2 systemd: Started Session 110 of user root.+ |6 X# y4 }8 f
Oct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.
3 o2 N+ D" V: [; V: g6 e1 \Oct 20 09:12:29 controller2 systemd: Started Session 111 of user root.1 a; H" e8 J) Q$ l5 i2 t" S# k

- u$ j( X; f0 g+ U/ I$ i1 ~& L" \6 f- h9 P% j- q$ \7 ^8 X& w  t
重启syslog1 B* B9 ^1 G3 t- R
^C" f2 h8 ~1 F  r
[root@controller2 ~]# systemctl restart rsyslog* t2 v" p. ~5 k# d/ }
. w" Q# u' G- p' `5 o
+ n% j. Y" I: ?
[root@controller2 ~]# tail -f /var/log/messages
2 y- @; u# g8 K* i6 A( tOct 20 09:01:19 controller2 systemd: Started Session 108 of user root.
! R! d1 j+ j& ^3 p' l7 w4 GOct 20 09:10:01 controller2 systemd: Started Session 110 of user root./ Z2 A% @5 l6 p" Z
Oct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.: w, c( z2 d0 F* d' E  b1 U% q
Oct 20 09:12:29 controller2 systemd: Started Session 111 of user root.- W% V# F* a% U; L
Oct 20 09:15:11 controller2 systemd: Stopping System Logging Service...
) f- Q' v+ f5 @, QOct 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.
. b- v$ R: o9 S2 d& |+ e! x+ BOct 20 09:15:11 controller2 systemd: Stopped System Logging Service.4 \0 \! ~4 v/ F" u4 y4 D8 e
Oct 20 09:15:11 controller2 systemd: Starting System Logging Service...
) ~/ J  ]9 @6 j1 ROct 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; X6 O! G. |  h+ D0 [& a
Oct 20 09:15:11 controller2 systemd: Started System Logging Service.9 N0 L$ f  _! {* ]+ c8 T4 H2 ?6 g4 j3 }
  |' x  o% {5 K7 D
暂未报错:% u. o3 B* k2 j+ q9 {' w6 _4 C

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2021-10-20 09:30:50 | 显示全部楼层
  手动修改配置文件:, ?& B" {9 ]& b" T2 b
" L2 m% s1 L+ M2 b7 i6 i
将/etc/systemd/system.conf 中 LogLevel=info 设置成如下:
$ {1 i( w; A2 v4 l) u3 S
7 L" @2 A- H6 I9 D#LogLevel=info7 r1 x5 H; F) v0 r+ [' y
LogLevel=notice
( k+ k5 S  D- Q( \
! r" W6 I4 A3 J; B2 Q; z5 J方法三:0 ]- ^3 V- D4 J9 ^/ n
通过系统命令,修改日志配置文件:! i' Q/ w7 S% M
systemd-analyze set-log-level notice4 I/ z9 [) D! J8 z+ G- x: y
- i' h+ c! ?, l
三、Linux服务器的日志管理
) c  H& m$ `3 ]' u; S) `6 [消息紧急程度排行:
/ H% p0 r; v9 p6 t  remerg:该系统不可用
5 p) ]$ ~- f6 w. talert:需要立即修改& V3 [% h+ \" n7 d
crit:紧急情况4 Q) u& o9 j( l  ]
err:错误信息% q5 A2 [: I: r7 [4 v& m6 m. X7 ]- m
warning:预警信息
6 b$ T" G6 X' F6 \notice:具有重要性的普通条件
3 r8 D) j$ ]9 Uinfo:提供信息的消息/ ~0 U( O9 V/ q# \7 w+ n, p
debug:不包含函数条件或问题的其他信息
- n" n1 `3 V1 @1 H5 Pnone:没有重要级,通常用于排错' C- L# G4 L) ?2 C' y8 h+ T
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 01:57 , Processed in 0.023704 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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