Linux系统日志收集命令sosreport

sosreport命令用于收集系统构架及配置信息,并打包输出为诊断文档。当我们系统中出现问题,可以使用这个命令搜集全面的系统诊断信息。

安装sosreport

yum -y install sos

参数说明:

-l	列出所有可用的插件及其选项
-n	禁用指定的插件
-e	启用指定的插件
-a	对于所有的插件启用,将所有布尔选项设置为True
-v	增加日志记录的详细程度
--no-report	禁用HTML报告写入
--config-file CONFIG	指定备用配置文件

实列:
列出所有可用的插件及其选项:

[root@localhost ~]# sosreport -l

sosreport (version 3.9)

目前已启用了以下插件:

 alternatives         System alternatives
 anaconda             Anaconda installer
 anacron              Anacron job scheduling service
 ansible              Ansible configuration management
 auditd               Audit daemon information
 block                Block device information
 boot                 Bootloader information
 btrfs                Btrfs filesystem
 cgroups              Control groups subsystem
 chrony               Chrony clock (for Network time protocol)
 console              Console and keyboard information
 cron                 Cron job scheduler
 crypto               System crypto services information
 date                 Basic system time information
 dbus                 D-Bus message bus
 devicemapper         device-mapper framework
 devices              devices specific commands
 dracut               Dracut initramfs generator
 ebpf                 eBPF tool
 filesys              Local file systems
 firewalld            Firewall daemon
 grub2                GRUB2 bootloader
 hardware             General hardware information
 host                 Host information
 hts                  Red Hat Hardware Test Suite
 i18n                 Internationalization
 jars                 Collect information about available Java archives.
 kdump                Kdump crash dumps
 kernel               Linux kernel
 krb5                 Kerberos authentication
 ldap                 LDAP configuration
 libraries            Dynamic shared libraries
 libvirt              libvirt virtualization API
 login                login information
 logrotate            LogRotate service
 logs                 System logs
 lvm2                 LVM2 volume manager
 md                   MD RAID subsystem
 memory               Memory configuration and use
 mpt                  LSI Message Passing Technology
 multipath            Device-mapper multipath tools
 networking           network and device configuration
 networkmanager       NetworkManager service configuration
 nis                  Network information service
 nss                  Network Security Services configuration
 ntb                  Linux PCI-Express Non-Transparent Bridge
 openhpi              Open Hardware Platform Interface
 openshift            Openshift 2.x node and broker
 openssl              openssl related information
 pam                  Pluggable Authentication Modules
 pci                  PCI devices
 perl                 Perl runtime
 postfix              Postfix smtp server
 process              process information
 processor            CPU information
 python               Python runtime
 release              Linux release information
 rpm                  RPM Package Manager
 scsi                 SCSI devices
 selinux              SELinux access control
 services             System services
 soundcard            Sound devices
 ssh                  Secure shell service
 sudo                 Sudo command execution
 system               core system information
 systemd              System management daemon
 sysvipc              SysV IPC
 teamd                Network interface teaming
 tuned                Tuned system tuning daemon
 udev                 udev dynamic device management
 unpackaged           Collects a list of files that are not handled by the package
    manager
 usb                  USB devices
 vhostmd              vhostmd virtualization metrics collection
 x11                  X windowing system
 xen                  Xen virtualization
 xfs                  XFS filesystem
 yum                  yum information

目前禁用了以下插件:

 abrt                 inactive       Automatic Bug Reporting Tool
 acpid                inactive       ACPI daemon information
 activemq             inactive       ActiveMQ message broker
 apache               inactive       Apache http daemon
 ata                  inactive       ATA and IDE information
 atomichost           inactive       Atomic Host
 autofs               inactive       Autofs on-demand automounter
 azure                inactive       Microsoft Azure client
 boom                 inactive       Configuration data for the boom boot manager.
 buildah              inactive       Buildah container and image builder
 candlepin            inactive       Candlepin entitlement management
 ceph                 inactive       CEPH distributed storage
 ceph_ansible         inactive       CEPH distributed storage - Ansible installer
 cifs                 inactive       SMB file system information
 clear_containers     inactive       Intel(R) Clear Containers configuration
 cloud_init           inactive       cloud-init instance configurations
 cman                 inactive       cman based Red Hat Cluster High Availability
 cobbler              inactive       Cobbler installation server
 cockpit              inactive       Cockpit Web Service
 collectd             inactive       Collectd config collector
 composer             inactive       Lorax Composer
 conntrackd           inactive       conntrackd - netfilter connection tracking user-space daemon
 container_log        inactive       All container logs
 convert2rhel         inactive       Convert2RHEL
 corosync             inactive       Corosync cluster engine
 crio                 inactive       CRI-O containers
 cs                   inactive       Certificate System and Dogtag
 ctdb                 inactive       Samba Clustered TDB
 cups                 inactive       CUPS IPP print service
 dhcp                 inactive       DHCP daemon
 distupgrade          inactive       Distribution upgrade data
 dlm                  inactive       DLM (Distributed lock manager)
 dmraid               inactive       dmraid software RAID
 dnf                  inactive       dnf package manager
 docker               inactive       Docker containers
 docker_distribution  inactive       Docker Distribution
 dovecot              inactive       dovecot server related information
 ds                   inactive       Directory Server
 elastic              inactive       ElasticSearch service
 etcd                 inactive       etcd plugin
 fcoe                 inactive       Fibre Channel over Ethernet
 fibrechannel         inactive       Collects information on fibrechannel devices, if present
 foreman              inactive       Foreman/Satellite 6 systems management
 frr                  inactive       Frr routing service
 fwupd                inactive       fwupd information
 gdm                  inactive       GNOME display manager
 gfs2                 inactive       GFS2 (Global Filesystem 2)
 gluster              inactive       GlusterFS storage
 gluster_block        inactive       Gluster Block
 gnocchi              inactive       Gnocchi - Metric as a service
 grafana              inactive       Fetch Grafana configuration, logs and CLI output
 grub                 inactive       GRUB bootloader
 gssproxy             inactive       GSSAPI Proxy
 haproxy              inactive       HAProxy load balancer
 hpasm                inactive       HP Advanced Server Management
 infiniband           inactive       Infiniband data
 insights             inactive       Collect config and log for Red Hat Insights
 ipa                  inactive       Identity, policy, audit
 ipmitool             inactive       IpmiTool hardware information.
 iprconfig            inactive       IBM Power RAID storage adapter configuration information
 ipvs                 inactive       Linux IP virtual server
 iscsi                inactive       iSCSI initiator
 iscsitarget          inactive       iSCSI target
 java                 inactive       Java runtime
 kata_containers      inactive       Kata Containers configuration
 keepalived           inactive       Keepalived routing server
 kernelrt             inactive       Realtime kernel variant
 keyutils             inactive       Kernel key ring
 kimchi               inactive       kimchi-related information
 kpatch               inactive       Kpatch information
 kubernetes           inactive       Red Hat Kubernetes plugin
 kvm                  inactive       Kernel virtual machine
 leapp                inactive       Leapp upgrade handling tool
 libreswan            inactive       Libreswan IPsec
 lightdm              inactive       Light Display Manager
 lilo                 inactive       Lilo bootloader
 lstopo               inactive       lstopo / machine topology/numa node information
 lustre               inactive       Lustre filesystem
 manageiq             inactive       ManageIQ/CloudForms related information
 megacli              inactive       LSI MegaRAID devices
 memcached            inactive       memcached distributed memory caching system
 migration_results    inactive       Information about conversions and upgrades
 mongodb              inactive       MongoDB document database
 monit                inactive       Monit monitoring daemon
 mssql                inactive       Microsoft SQL Server on Linux
 mysql                inactive       MySQL and MariaDB RDBMS
 named                inactive       BIND named server
 navicli              inactive       EMC Navicli
 nfs                  inactive       Network file system information
 nfsganesha           inactive       NFS-Ganesha file server information
 nginx                inactive       nginx http daemon
 nodejs               inactive       Get runtime version of NodeJS
 npm                  inactive       Get info about available npm modules
 nscd                 inactive       Name service caching daemon
 ntp                  inactive       Network time protocol
 numa                 inactive       NUMA state and configuration
 nvidia               inactive       Nvidia GPU information
 nvme                 inactive       Collect config and system information about NVMe devices
 oddjob               inactive       OddJob task scheduler
 omnipath_client      inactive       OmniPath Tools and Fast Fabric Client
 omnipath_manager     inactive       OmniPath Fabric Manager
 omsa                 inactive       Dell OpenManage Server Administrator (OMSA)
 opencl               inactive       OpenCL
 opendaylight         inactive       OpenDaylight network manager
 opengl               inactive       OpenGL
 openstack_ansible    inactive       OpenStack-Ansible sos plugin.
 openstack_aodh       inactive       OpenStack Alarm service
 openstack_ceilometer inactive       Openstack Ceilometer
 openstack_cinder     inactive       OpenStack cinder
 openstack_glance     inactive       OpenStack Glance
 openstack_heat       inactive       OpenStack Heat
 openstack_horizon    inactive       OpenStack Horizon
 openstack_instack    inactive       OpenStack Instack
 openstack_ironic     inactive       OpenStack Ironic
 openstack_keystone   inactive       OpenStack Keystone
 openstack_manila     inactive       OpenStackManila related information for Red Hat distributions.
 openstack_neutron    inactive       OpenStack Networking
 openstack_nova       inactive       OpenStack Nova
 openstack_novajoin   inactive       OpenStack Novajoin
 openstack_octavia    inactive       Openstack Octavia
 openstack_placement  inactive       OpenStack Placement
 openstack_sahara     inactive       OpenStack sahara related information for Red Hat distributions.
 openstack_swift      inactive       OpenStack Swift
 openstack_tripleo    inactive       Fetch installation informations from OpenStack Installer
 openstack_trove      inactive       OpenStack Trove
 openvswitch          inactive       OpenVSwitch networking
 origin               inactive       OpenShift Enterprise / OpenShift Container Platform
 os_net_config        inactive       OpenStack Net Config
 ovirt                inactive       oVirt Engine
 ovirt_engine_backup  inactive       oVirt Engine database backup
 ovirt_hosted_engine  inactive       oVirt Hosted Engine
 ovirt_imageio        inactive       oVirt Image I/O Daemon / Proxy
 ovirt_node           inactive       oVirt Node specific information
 ovirt_provider_ovn   inactive       oVirt OVN Provider
 ovn_central          inactive       OVN Northd
 ovn_host             inactive       OVN Controller
 pacemaker            inactive       Pacemaker high-availability cluster resource manager
 pcp                  inactive       Performance Co-Pilot data
 peripety             inactive       Peripety Storage Event Monitor
 podman               inactive       Podman containers
 postgresql           inactive       PostgreSQL RDBMS
 powerpath            inactive       EMC PowerPath
 powerpc              inactive       IBM Power systems
 ppp                  inactive       Point-to-point protocol
 psacct               inactive       Process accounting information
 ptp                  inactive       Precision time protocol
 pulp                 inactive       Pulp platform
 pulpcore             inactive       This is the base class for sosreport plugins. Plugins should subclass
    this and set the class variables where applicable.

    plugin_name is a string returned by plugin.name(). If this is set to None
    (the default) class\_.__name__.tolower() will be returned. Be sure to set
    this if you are defining multiple plugins that do the same thing on
    different platforms.

    requires_root is a boolean that specifies whether or not sosreport should
    execute this plugin as a super user.

    version is a string representing the version of the plugin. This can be
    useful for post-collection tooling.

    packages (files) is an iterable of the names of packages (the paths
    of files) to check for before running this plugin. If any of these packages
    or files is found on the system, the default implementation of
    check_enabled will return True.

    profiles is an iterable of profile names that this plugin belongs to.
    Whenever any of the profiles is selected on the command line the plugin
    will be enabled (subject to normal check_enabled tests).
 puppet               inactive       Puppet service
 pxe                  inactive       PXE service
 qpid                 inactive       Qpid messaging
 qpid_dispatch        inactive       Qpid dispatch router
 qt                   inactive       QT widget toolkit
 quagga               inactive       Quagga routing service
 rabbitmq             inactive       RabbitMQ messaging service
 radius               inactive       RADIUS service information
 rasdaemon            inactive       rasdaemon kernel trace event monitor
 rear                 inactive       Relax and Recover
 redis                inactive       Redis, in-memory data structure store
 rhcos                inactive       Red Hat CoreOS
 rhui                 inactive       Red Hat Update Infrastructure
 rhv_analyzer         inactive       RHV Log Collector Analyzer
 rpmostree            inactive       rpm-ostree image/package system
 ruby                 inactive       Ruby runtime
 runc                 inactive       runC container runtime
 s390                 inactive       IBM S/390
 salt                 inactive       Salt
 saltmaster           inactive       Salt Master
 samba                inactive       Samba Windows interoperability
 sanlock              inactive       SANlock daemon
 saphana              inactive       SAP HANA
 sapnw                inactive       SAP NetWeaver
 sar                  inactive       System Activity Reporter
 sas3ircu             inactive       SAS-3 Integrated RAID adapter information
 sendmail             inactive       sendmail service
 skydive              inactive       Skydive, a network topology and protocols analyzer
 smartcard            inactive       PKCS#11 smart cards
 snappy               inactive       Snap packages
 snmp                 inactive       Simple network management protocol
 sos_extras           inactive       Collect extra data defined in /etc/sos.extras.d/ .
 squid                inactive       Squid caching proxy
 ssmtp                inactive       sSMTP information
 sssd                 inactive       System security service daemon
 storageconsole       inactive       Red Hat Storage Console
 stratis              inactive       Stratis Storage
 subscription_manager inactive       subscription-manager information
 sunrpc               inactive       Sun RPC service
 symcli               inactive       EMC Symcli
 systemtap            inactive       SystemTap dynamic instrumentation
 targetcli            inactive       TargetCLI TCM/LIO configuration
 tftpserver           inactive       TFTP server
 tomcat               inactive       Apache Tomcat server
 upstart              inactive       Upstart init system
 validation_framework inactive       Fetch run logs provided by the Validation Framework
 vdo                  inactive       Virtual Data Optimizer
 vdsm                 inactive       vdsm plugin
 veritas              inactive       Veritas software
 virsh                inactive       client for libvirt virtualization API
 virtwho              inactive       Virt-Who agent
 vmware               inactive       VMWare client information
 vsftpd               inactive       Vsftpd server
 vulkan               inactive       Vulkan
 watchdog             inactive       Watchdog information.
 wireless             inactive       Wireless
 xinetd               inactive       xinetd information
 zfs                  inactive       ZFS filesystem

The following options are available for ALL plugins:
 timeout                   -1              Timeout in seconds for plugin
 postproc                  True            Enable post-processing collected plugin data

以下插件选项可用:
 boot.all-images           off             collect lsinitrd for all images
 filesys.lsof              off             gathers information on all open files
 filesys.dumpe2fs          off             dump filesystem information
 filesys.frag              off             filesystem fragmentation status
 jars.append_locations                     colon-separated list of additional JAR paths
 jars.all_known_locations  off             scan all known paths
 kernel.with-timer         off             gather /proc/timer* statistics
 kernel.trace              off             gather /sys/kernel/debug/tracing/trace file
 libraries.ldconfigv       off             collect verbose ldconfig output
 lvm2.lvmdump              off             collect an lvmdump tarball
 lvm2.lvmdump-am           off             attempt to collect an lvmdump with advanced options and raw metadata collection
 networking.traceroute     off             collect a traceroute to www.example.com
 networking.namespace_pattern                 Specific namespaces pattern to be collected, namespaces pattern should be separated by whitespace as for example "eth* ens2"
 networking.namespaces     0               Number of namespaces to collect, 0 for unlimited. Incompatible with the namespace_pattern plugin option
 networking.ethtool_namespaces on              Define if ethtool commands should be collected for namespaces
 networking.eepromdump     off             collect 'ethtool -e' for all devices
 openshift.broker          off             Gathers broker specific files
 openshift.node            off             Gathers node specific files
 process.lsof              on              gathers information on all open files
 process.lsof-threads      off             gathers threads' open file info if supported
 process.smaps             off             gathers all /proc/*/smaps files
 python.hashes             off             gather hashes for all python files
 rpm.rpmq                  on              queries for package information via rpm -q
 rpm.rpmva                 off             runs a verify on all packages
 rpm.rpmdb                 off             collect /var/lib/rpm
 selinux.fixfiles          off             Print incorrect file context labels
 services.servicestatus    off             get a status of all running services
 yum.yumlist               off             list repositories and packages
 yum.yumdebug              off             gather yum debugging data
 yum.yum-history-info      off             gather yum history info

 Profiles: boot, container, debug, desktop, hardware, identity, java,
           kernel, mail, memory, network, openshift, packagemanager,
           performance, perl, sap, security, services, storage, sysmgmt,
           system, virt, webserver

 23 profiles, 77 plugins

使用-a参数,启用所有列出来的插件:

执行命令后直接回车,自动生成文件会有相应路径
[root@localhost ~]# sosreport -a

sosreport (version 3.9)

This command will collect diagnostic and configuration information from
this CentOS Linux system and installed applications.

An archive containing the collected information will be generated in
/var/tmp/sos.q5ODx_ and may be provided to a CentOS support
representative.

Any information provided to CentOS will be treated in accordance with
the published support policies at:

  https://wiki.centos.org/support

The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before being
passed to any third party.

No changes will be made to system configuration.

按 ENTER 键继续,或者 CTRL-C 组合键退出。

Please enter the case id that you are generating this report for []:

 Setting up archive ...
 Setting up plugins ...
[plugin:firewalld] skipped command 'nft list ruleset': required kmods missing: nfnetlink, nf_tables.  Use '--allow-system-changes' to enable collection.
[plugin:networking] skipped command 'ip6tables -t nat -nvL': required kmods missing: ip6table_nat.
[plugin:networking] skipped command 'ip6tables -t mangle -nvL': required kmods missing: ip6table_mangle.
[plugin:networking] skipped command 'ip6tables -t filter -nvL': required kmods missing: ip6table_filter.
[plugin:networking] skipped command 'nft list ruleset': required kmods missing: nf_tables.
[plugin:networking] skipped command 'ip -s macsec show': required kmods missing: macsec.  Use '--allow-system-changes' to enable collection.
[plugin:networking] skipped command 'ss -peaonmi': required kmods missing: inet_diag, udp_diag, tcp_diag, netlink_diag, af_packet_diag, unix_diag.  Use '--allow-system-changes' to enable collection.
[plugin:networking] skipped command 'iptables -vnxL': required kmods missing: iptable_filter.
[plugin:networking] skipped command 'ip6tables -vnxL': required kmods missing: ip6table_filter.
[plugin:networking] WARNING (about to collect 'ethtool -e lo'): collecting an eeprom dump is known to cause certain NIC drivers (e.g. bnx2x/tg3) to interrupt device operation
[plugin:networking] WARNING (about to collect 'ethtool -e ens33'): collecting an eeprom dump is known to cause certain NIC drivers (e.g. bnx2x/tg3) to interrupt device operation
 Running plugins. Please wait ...

  Finishing plugins              [Running: rpm]
  Finished running plugins
生成压缩归档......

Your sosreport has been generated and saved in:
  /var/tmp/sosreport-localhost-2023-10-11-lgpcnwx.tar.xz

 Size   20.64MiB
 Owner  root
 md5    fce16487a48d6904398ea63d1bccb1a9

Please send this file to your support representative.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

睡不醒的猪儿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值