易陆发现互联网技术论坛

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

systemd: Started Session *** of user root

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

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

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

x
系统message日志无故报 systemd: Started Session :+ a: f9 ]3 ^/ }- v8 r4 M
Oct 20 09:01:19 controller2 systemd: Started Session 108 of user root.; c; d. _# |: U, k9 e9 f% `! P
Oct 20 09:10:01 controller2 systemd: Started Session 110 of user root.
, ^# k0 Z( L/ v) _3 \  ^% AOct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.
3 D: R3 s& M5 }1 \( rOct 20 09:12:29 controller2 systemd: Started Session 111 of user root.1 O5 z, |/ c& _: a  k
^C
) ~) b' x$ B( @5 |$ L! p6 N[root@controller2 ~]#
; w( n2 h7 W3 ]
5 W; O8 z! ~3 M! y) b解决办法:添加syslog配置 7 x$ s9 M7 m8 c& {6 ?/ X3 c3 Q/ W
[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
( M  k' g7 E% N0 \1 _2 ]2 e- |9 z[root@controller2 ~]#  0 x& o6 }, Q, R( f! ]  N
[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
9 n/ S0 O8 e  t, Z. ]1 |
& K2 e2 H' J5 d5 w1 M. g3 e5 R' i4 y% X* n
[root@controller2 ~]# tail -f /var/log/messages
& ?6 m& c* M& i9 ?Oct 20 08:10:01 controller2 systemd: Started Session 102 of user root.  f% J$ b  K- o. ?) ~1 H5 s( D
Oct 20 08:20:01 controller2 systemd: Started Session 103 of user root.
# R9 k. d" ^: ]) F# I$ G& |* K( U4 qOct 20 08:30:01 controller2 systemd: Started Session 104 of user root.
" B0 {8 h0 K! S1 f2 o+ f& oOct 20 08:40:01 controller2 systemd: Started Session 105 of user root.
& s. b& v) s- y0 cOct 20 08:50:01 controller2 systemd: Started Session 106 of user root.
: X6 P& [; X6 @* OOct 20 09:00:01 controller2 systemd: Started Session 107 of user root.
4 j9 s) _; C5 @# x& {5 r; a' cOct 20 09:01:19 controller2 systemd: Started Session 108 of user root.
  n5 K* |5 o' _# C4 {9 OOct 20 09:10:01 controller2 systemd: Started Session 110 of user root.& `. \9 t( U! ~4 D3 T3 B0 y
Oct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.$ R: W8 K8 c3 j2 U
Oct 20 09:12:29 controller2 systemd: Started Session 111 of user root.7 j$ }+ Z  C  E: [
8 j+ U8 r! S0 |& A& [
7 Q5 }6 k4 U% [% w& s
重启syslog% O% Y, p3 p( k6 h1 k6 x
^C, v+ L9 l+ C+ v4 H) y% @
[root@controller2 ~]# systemctl restart rsyslog
' C: x, S( G& C# q. Q; h
; L) M2 M1 d+ V9 L5 Z/ t" P4 p0 I7 S0 x5 B. U5 _) h1 T
[root@controller2 ~]# tail -f /var/log/messages
) a1 W1 y2 i. _1 J9 xOct 20 09:01:19 controller2 systemd: Started Session 108 of user root.
2 o, H' l) s1 G5 FOct 20 09:10:01 controller2 systemd: Started Session 110 of user root.1 f! x" ]* U3 A
Oct 20 09:12:29 controller2 systemd-logind: New session 111 of user root.
1 u0 P, A* f# x' N6 }Oct 20 09:12:29 controller2 systemd: Started Session 111 of user root.* p: |  w2 U, e4 I8 S
Oct 20 09:15:11 controller2 systemd: Stopping System Logging Service...
7 Z' R# G/ K3 L/ F  a/ gOct 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.0 D3 ?6 |5 h, T$ e  j/ o* E
Oct 20 09:15:11 controller2 systemd: Stopped System Logging Service.+ V+ o, K: p2 y4 l) H; p* H
Oct 20 09:15:11 controller2 systemd: Starting System Logging Service...) C8 Q# H& [' `0 z* Z% i& Z) _  Q
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+ F- l; |' E. \4 d# zOct 20 09:15:11 controller2 systemd: Started System Logging Service.
& ]3 [9 k6 O- g% X* P% k3 H; q) w
  q3 {+ f1 F  l! ~$ v0 p1 K8 s! U暂未报错:
* F0 y! ?; g) P1 A# j8 g
 楼主| 发表于 2021-10-20 09:30:50 | 显示全部楼层
  手动修改配置文件:
2 b# G: b6 s5 W) k/ c9 y0 D6 v; ^$ G% Y/ a! P0 j
将/etc/systemd/system.conf 中 LogLevel=info 设置成如下:
+ w3 X2 z/ X) N1 Q( }* ?7 C& j 4 W4 a, r! @2 [' c; G. A4 O. `
#LogLevel=info
" Q; ]+ X2 V' V- X, C2 hLogLevel=notice6 X4 K) k7 p8 W% C( d& t& ]* B
+ w: p1 x. F* m) ]1 g3 D! }5 }
方法三:( p  f0 L# V1 z7 t& d6 a+ l0 x
通过系统命令,修改日志配置文件:
2 ^$ U: E' H2 x0 ^9 x! W- G9 n/ b7 Csystemd-analyze set-log-level notice' F) P( Q0 e4 @1 p1 D3 i* g
* `* Z3 v6 t" N3 H' w" F0 @. P
三、Linux服务器的日志管理
  o/ O9 }  _& Y% u消息紧急程度排行:
) z( A3 P, T9 e: B7 kemerg:该系统不可用9 K+ N2 h' {5 ~$ @3 D0 @" l( q( e
alert:需要立即修改
8 t& E+ g2 z8 }crit:紧急情况
/ \* E3 v6 n& xerr:错误信息' j5 y, c! p# C( _
warning:预警信息
$ y$ P/ {/ v6 {8 ?4 A/ v: Rnotice:具有重要性的普通条件
/ M- Z* R6 b9 W- A9 G% finfo:提供信息的消息
9 n. K) L/ `3 B8 f; Pdebug:不包含函数条件或问题的其他信息( w  f# N9 |! _
none:没有重要级,通常用于排错
9 E' X" c% R% m9 x9 W
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

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

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

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

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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