当前位置:   article > 正文

ubuntu 找不到 syslog.service_ubuntu没有syslog

ubuntu没有syslog


前言

关于使用命令 systemctl disable syslog.service 之后, systemctl enable syslog.service 命令失败的问题:

root@backvm-virtual-machine:~# systemctl  enable  syslog.service
Failed to execute operation: No such file or directory
  • 1
  • 2

一、syslog.service 名字找不到

通过网上查找,看到这么一条信息:
在这里插入图片描述
于是尝试执行命令,使用 rsyslog.service:

root@backvm-virtual-machine:~# systemctl  enable  rsyslog.service 
Synchronizing state of rsyslog.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable rsyslog
Created symlink from /etc/systemd/system/syslog.service to /lib/systemd/system/rsyslog.service.
root@backvm-virtual-machine:~# 
  • 1
  • 2
  • 3
  • 4
  • 5

二、探究

查看一下当前系统的syslog.service 服务

root@backvm-virtual-machine:~# ls /etc/systemd/system -l
总用量 100
drwxr-xr-x 2 root root 4096 227  2019 suspend.target.wants
drwxr-xr-x 2 root root 4096 520  2020 sysinit.target.wants
lrwxrwxrwx 1 root root   35 826 23:56 syslog.service -> /lib/systemd/system/rsyslog.service
drwxr-xr-x 2 root root 4096 227  2019 timers.target.wants
root@backvm-virtual-machine:~# 
root@backvm-virtual-machine:~# 
root@backvm-virtual-machine:~# systemctl status  syslog.service 
● rsyslog.service - System Logging Service
   Loaded: loaded (/lib/systemd/system/rsyslog.service; enabled; vendor preset: enabled)
   Active: active (running) since 五 2022-08-26 23:48:31 CST; 58min ago
     Docs: man:rsyslogd(8)
           http://www.rsyslog.com/doc/
 Main PID: 27572 (rsyslogd)
   CGroup: /system.slice/rsyslog.service
           └─27572 /usr/sbin/rsyslogd -n

826 23:48:30 backvm-virtual-machine systemd[1]: Stopped System Logging Service.
826 23:48:31 backvm-virtual-machine systemd[1]: Starting System Logging Service...
826 23:48:31 backvm-virtual-machine systemd[1]: Started System Logging Service.
root@backvm-virtual-machine:~# 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

可以看到,syslog.service 指向 /lib/systemd/system/rsyslog.service。
且 syslog.service 服务运行正常。

我们 cat 查看一下 syslog.service 和 rsyslog.service 两个配置文件有什么区别:

root@backvm-virtual-machine:~# systemctl cat syslog.service 
# /lib/systemd/system/rsyslog.service
[Unit]
Description=System Logging Service
Requires=syslog.socket
Documentation=man:rsyslogd(8)
Documentation=http://www.rsyslog.com/doc/

[Service]
Type=notify
ExecStart=/usr/sbin/rsyslogd -n
StandardOutput=null
Restart=on-failure

[Install]
WantedBy=multi-user.target
Alias=syslog.service
root@backvm-virtual-machine:~#
root@backvm-virtual-machine:~#
root@backvm-virtual-machine:~# systemctl cat rsyslog.service 
# /lib/systemd/system/rsyslog.service
[Unit]
Description=System Logging Service
Requires=syslog.socket
Documentation=man:rsyslogd(8)
Documentation=http://www.rsyslog.com/doc/

[Service]
Type=notify
ExecStart=/usr/sbin/rsyslogd -n
StandardOutput=null
Restart=on-failure

[Install]
WantedBy=multi-user.target
Alias=syslog.service
root@backvm-virtual-machine:~# 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37

在这里插入图片描述
通过文件内容,可以看到,原来是 rsyslog.service 指定了别名为:syslog.service。


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/664240
推荐阅读
相关标签
  

闽ICP备14008679号