文件操作 - logs.cpython-310.pyc
返回文件管理
返回主菜单
删除本文件
文件: /usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/logs.cpython-310.pyc
编辑文件内容
o i��d� � @ sX d dl Z d dlmZmZmZmZ G dd� de�ZG dd� dee�ZG dd� dee�ZdS ) � N)�Plugin� PluginOpt�IndependentPlugin� CosPluginc @ s( e Zd ZdZdZdZdd� Zdd� ZdS ) �LogsBasezSystem logs�logs��system�hardware�storagec s� ddg}g }� � d�}� �d�r?t� �d�d��}|�� D ]}|�d�r/|t�|�� d �7 }qW d � n1 s:w Y |D ]}� �� �|��sLqA� �|�}|� �d|�7 }qA|D ]}|�d�ri|dd � }� � |�rs� � |� q\� � g d �� � �d � � �d� t� fdd �dD ��}|r�� � d�r�� j|ddgdd� � jd|dd� � jd|dd� � � d�r�� � ddg� d S d S � � d�sψ � g d�� d S � � g d�� d S )N�/etc/syslog.conf�/etc/rsyslog.conf�since�rz$IncludeConfig� z^\S+\s+(-?\/.*$)\s+�-) r r z/etc/rsyslog.dz/var/log/boot.logz/var/log/installerz/var/log/messages*z/var/log/secure*z /var/log/udevz/var/log/dist-upgradezjournalctl --disk-usagezls -alRh /var/log/c s g | ]}� � � �|d ���qS )zlog/journal/)�path_exists� path_join)�.0�p��self� �9/usr/lib/python3/dist-packages/sos/report/plugins/logs.py� <listcomp>? s �z"LogsBase.setup.<locals>.<listcomp>)z/varz/runzsystemd-journald�journal_full�journal_all�d )r �tags�priority�this�journal_since_boot)�bootr r �last�journal_last_boot�all_logsz/var/log/journal/*z/run/log/journal/*) z/var/log/syslogz/var/log/syslog.1z/var/log/syslog.2*z/var/log/kern.logz/var/log/kern.log.1z/var/log/kern.log.2*z/var/log/auth.logz/var/log/auth.log.1z/var/log/auth.log.2*)z/var/log/syslog*z/var/log/kern.log*z/var/log/auth.log*)� get_optionr �openr � readlines� startswith�glob�split�do_regex_find_all�path_isfile� add_copy_spec�add_cmd_output�any� is_service�add_journal) r �confsr r �conf�line�config�i�journalr r r �setup s^ ��� � ���� �� zLogsBase.setupc C s | � ddd� d S )Nz /etc/rsyslog*z (ActionLibdbiPassword |pwd=)(.*)z\1[********])�do_path_regex_subr r r r �postproca s �zLogsBase.postprocN)�__name__� __module__�__qualname__� short_desc�plugin_name�profilesr9 r; r r r r r s Mr c @ s e Zd ZdZdZdZdS )�IndependentLogsa� This plugin will collect logs traditionally considered to be "system" logs, meaning those such as /var/log/messages, rsyslog, and journals that are not limited to unit-specific entries. Note that the --since option will apply to journal collections by this plugin as well as the typical application to log files. Most users can expect typical journal collections to include the "full" journal, as well as journals limited to this boot and the previous boot. r r N)r<