관리-도구
편집 파일: logs.cpython-39.opt-1.pyc
a -�_g9 � @ 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��systemZhardwareZstoragec s� d}d|g}g }� � |�r|t� �|�ddd��>}|�� D ]$}|�d�r8|t�|�� d �7 }q8W d � n1 sr0 Y |D ]0}� � � �|��s�q�� �|�}|� �d|�7 }q�|D ].}|�d �r�|dd � }� �|�r�� � |� q�� � g d �� � � d� � jdd d� t� fdd�dD ��}|�r~� � d��r~� jddgdd� � jddd� � jddd� � �d��r�� � ddg� n*� �d��s�� � g d�� n� � g d �� d S )!Nzetc/rsyslog.conf�/etc/syslog.conf�rzUTF-8)�encodingz$IncludeConfig� z^\S+\s+(-?\/.*$)\s+�-) r z/etc/rsyslog.confz/etc/rsyslog.dz/var/log/boot.logz/var/log/installerz/var/log/messages*z/var/log/secure*z /var/log/udevz/var/log/dist-upgrade�/var/log/auth.logzjournalctl --disk-usagez/var/logT)� recursivec 3 s | ]}� � � �|d ��V qdS )zlog/journal/N)�path_exists� path_join)�.0�p��self� �;/usr/lib/python3.9/site-packages/sos/report/plugins/logs.py� <genexpr>? s �z!LogsBase.setup.<locals>.<genexpr>)z/varz/runzsystemd-journaldZjournal_fullZjournal_all�d )�tags�priority�thisZjournal_since_boot)Zbootr �lastZjournal_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*r z/var/log/auth.log.1z/var/log/auth.log.2*)z/var/log/syslog*z/var/log/kern.log*z/var/log/auth.log*)r �openr � readlines� startswith�glob�splitZdo_regex_find_allZpath_isfileZ add_copy_spec�add_cmd_outputZadd_dir_listing�anyZ is_service�add_journal� get_option) r ZrsyslogZconfsr Zconf�lineZconfig�iZjournalr r r �setup sL 6 � ��zLogsBase.setupc C s | � ddd� d S )Nz /etc/rsyslog*z (ActionLibdbiPassword |pwd=)(.*)z\1[********])Zdo_path_regex_subr r r r �postproc_ s �zLogsBase.postprocN)�__name__� __module__�__qualname__Z short_desc�plugin_name�profilesr+ r, r r r r r s Kr 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- r. r/ �__doc__r0 r1 r r r r r2 g s r2 c s, e Zd Zedddd�gZ� fdd�Z� ZS )�CosLogs�log-days� z"the number of days logs to collect)�name�defaultZdescc sD t � �� | �d�r | �d� n | �dd�}| jd|� d�d� d S )Nr zjournalctl -o exportr5 r6 r �days)Zsince)�superr+ r( r% r'