Current File : //usr/lib/python3.6/site-packages/sos/report/plugins/__pycache__/logs.cpython-36.pyc |
3
\��h� � @ 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 � Zd
S )�LogsBasezSystem logs�logs�system�hardware�storagec s� d}d|g}g }� j |�rlt� j|�ddd��8}x0|j� D ]$}|jd�r:|tj|j� d �7 }q:W W d Q R X x8|D ]0}� j � j|��s�qr� j|�}|� jd|�7 }qrW x6|D ].}|jd �r�|dd � }� j|�r�� j |� q�W � j d
ddd
ddddddddg� � j
d� � jdddd� t� fdd�d+D ��}|�r�� j
d��r�� jdd gd!d"� � jd#d$d%� � jd&d'd%� � jd(��r�� j d)d*g� d S ),Nzetc/rsyslog.confz/etc/syslog.conf�rzUTF-8)�encodingz$IncludeConfig� z^\S+\s+(-?\/.*$)\s+�-z/var/log/auth.log*z/var/log/boot.logz/var/log/dist-upgradez/var/log/installerz/var/log/kern.log*z/var/log/messages*z/var/log/secure*z/var/log/syslog*z
/var/log/udevz/etc/rsyslog.confz/etc/rsyslog.dzjournalctl --disk-usagez/var/logT�s)� recursiveZ
extra_optsc 3 s | ]}� j � j|d ��V qdS )zlog/journal/N)�path_exists� path_join)�.0�p)�self� �/usr/lib/python3.6/logs.py� <genexpr>A s z!LogsBase.setup.<locals>.<genexpr>�/var�/runzsystemd-journaldZjournal_fullZjournal_all�d )�tagsZpriority�thisZjournal_since_boot)Zbootr ZlastZjournal_last_boot�all_logsz/var/log/journal/*z/run/log/journal/*)r r )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�line�config�iZjournalr )r r �setup sX
$
zLogsBase.setupc C s | j ddd� d S )Nz
/etc/rsyslog*z (ActionLibdbiPassword |pwd=)(.*)z\1[********])Zdo_path_regex_sub)r r r r �postprocN s zLogsBase.postprocN)r r r
)�__name__�
__module__�__qualname__Z
short_desc�plugin_name�profilesr+ r, r r r r r
s
:r 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 r r
N)r r r
)r- r. r/ �__doc__r0 r1 r r r r r2 V s
r2 c s, e Zd Zedddd�gZ� fdd�Z� ZS )�CosLogszlog-days� z"the number of days logs to collect)�name�defaultZdescc sD t � j� | jd�r | jd� n | jdd�}| jd|� d�d� d S )Nr zjournalctl -o exportzlog-daysr5 r �days)Zsince)�superr+ r'