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

systemd: Started Session *** of user root

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2021-10-20 09:26:09 | 显示全部楼层 |阅读模式
系统message日志无故报 systemd: Started Session :
8 D: j7 T8 N- o" \Oct 20 09:01:19 controller2 systemd: Started Session 108 of user root.
8 ?+ r  R& p2 R% p4 D3 K% hOct 20 09:10:01 controller2 systemd: Started Session 110 of user root.
9 m) r$ h9 T# m% P/ r3 g' JOct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.
6 ^$ F% x- Y8 M% N; ]9 x7 JOct 20 09:12:29 controller2 systemd: Started Session 111 of user root.
; s5 J# C2 u2 R. z6 [' D8 W. ~^C
9 }, m& h" z( {! T[root@controller2 ~]#& P( F9 z! O$ G) O5 z: z7 Q
& G% Z4 B6 E: v: ^
解决办法:添加syslog配置 $ `" Y3 ?0 O: ~) |8 S( S, f
[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  q+ p: o$ x4 M! g1 j& r
[root@controller2 ~]#  5 j5 D2 U9 J% V/ y! E6 G
[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
+ y. V; O7 ]+ H* b- T: [5 R
" p4 Y& y5 i/ M  ^5 C9 H! d7 _
- r$ y1 b4 N! \( w8 C5 A[root@controller2 ~]# tail -f /var/log/messages
; B8 c% \0 L8 ^Oct 20 08:10:01 controller2 systemd: Started Session 102 of user root.' J  j. d! }+ \
Oct 20 08:20:01 controller2 systemd: Started Session 103 of user root.+ [7 M, k( E! ?: D& }
Oct 20 08:30:01 controller2 systemd: Started Session 104 of user root.
; I! @8 C# @$ SOct 20 08:40:01 controller2 systemd: Started Session 105 of user root.8 o6 U8 u" Z6 M
Oct 20 08:50:01 controller2 systemd: Started Session 106 of user root.+ ^: Q8 n' |$ t1 G
Oct 20 09:00:01 controller2 systemd: Started Session 107 of user root.
. m' d, G1 `2 |4 J1 b, vOct 20 09:01:19 controller2 systemd: Started Session 108 of user root.
- u) P0 |' x1 k& i7 Y- z: |- rOct 20 09:10:01 controller2 systemd: Started Session 110 of user root.
! f: \2 K5 G4 ]+ W2 s0 j; \" oOct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.
& q  _1 r6 b) D5 XOct 20 09:12:29 controller2 systemd: Started Session 111 of user root." x' k8 b1 N* O4 l, I4 o% Z3 v, O* }

" E. x! }, l: a0 A; }, T( L$ s! C' T' A
重启syslog
: r9 a" [" U: ?^C2 M* n0 e7 F0 i5 A5 x7 u2 m/ V
[root@controller2 ~]# systemctl restart rsyslog: w+ n5 r3 W' Y7 }  B' F

- q8 ^4 _1 Z' }: m* j9 A0 E) Y8 y* Y1 @. t! ~/ T
[root@controller2 ~]# tail -f /var/log/messages
! r! `1 i  Z% U' q0 Y# N4 i: dOct 20 09:01:19 controller2 systemd: Started Session 108 of user root.
5 ?* v# F' W" y0 F+ @! B( gOct 20 09:10:01 controller2 systemd: Started Session 110 of user root.) K8 {5 V6 W7 u8 u
Oct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.# z3 {  i7 J- `; L5 N9 w9 _+ j' ~
Oct 20 09:12:29 controller2 systemd: Started Session 111 of user root.
" e  s5 u* F: T/ L3 q+ V$ o2 `Oct 20 09:15:11 controller2 systemd: Stopping System Logging Service...
0 Y; A- V/ g* H8 @- D7 \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.
1 K$ v7 a4 Q5 \# c3 n! FOct 20 09:15:11 controller2 systemd: Stopped System Logging Service.7 ^( k  v% R$ J: e7 s
Oct 20 09:15:11 controller2 systemd: Starting System Logging Service...6 ^9 c  J7 c! s, _
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"] start4 r- I8 f" J. w
Oct 20 09:15:11 controller2 systemd: Started System Logging Service.
. m3 B# e0 U% G4 _% p
5 h! q/ ^9 H; W% N% L1 i. `6 k暂未报错:
/ T; ]  M, W6 b+ E% b* i

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2021-10-20 09:30:50 | 显示全部楼层
  手动修改配置文件:" o  ]* U* h4 h  s& b4 j; Y4 e. f! t

4 z: n8 x3 X' W7 E. ?将/etc/systemd/system.conf 中 LogLevel=info 设置成如下:
+ y4 r; S7 F( F- y 3 ^) B, y" D5 @1 q) v6 ^
#LogLevel=info
6 H8 }6 J$ T8 z  lLogLevel=notice4 b& r7 d/ d) V( V

+ K" U# ]9 y  M8 }3 q方法三:
+ H! @' Q8 G5 }4 s) p4 Z: U通过系统命令,修改日志配置文件:' A- R4 ?/ Q- }+ c& q
systemd-analyze set-log-level notice
  \, }2 u1 G0 N8 e, z
; x& r8 G0 h2 o; b) C三、Linux服务器的日志管理
' t% r; ]- l( `1 e, j消息紧急程度排行:
9 ?" w3 p; e( o/ K/ ?emerg:该系统不可用
' l) r. u9 |- B! aalert:需要立即修改
/ u( w* I. P8 gcrit:紧急情况
! v2 h; I% q2 w- B/ i) c3 serr:错误信息
& T- Q5 D7 D$ S- l: G6 \/ Iwarning:预警信息
8 O4 h! @$ m2 k8 ~$ \notice:具有重要性的普通条件
3 ]+ ]+ z- C, g5 B5 B9 pinfo:提供信息的消息  `5 v1 t; ~6 P+ b, O
debug:不包含函数条件或问题的其他信息
" v3 u4 `7 g: x6 K8 fnone:没有重要级,通常用于排错) w) b. l' a! L. @$ Z2 q$ e
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 03:02 , Processed in 0.020951 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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