Sindbad~EG File Manager

Current Path : /lib/python3.6/site-packages/sos/report/plugins/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/sos/report/plugins/__pycache__/logs.cpython-36.pyc

3

�f��@sXddlZddlmZmZmZmZGdd�de�ZGdd�dee�ZGdd�dee�ZdS)	�N)�Plugin�	PluginOpt�IndependentPlugin�	CosPluginc@s(eZdZdZdZdZdd�Zdd	�Zd
S)�LogsBasezSystem logs�logs�system�hardware�storagec
s�d}d|g}g}�jd�}�j|�rvt�j|�ddd��8}x0|j�D]$}|jd�rD|tj|j�d�7}qDWWdQRXx8|D]0}�j�j|��s�q|�j|�}|�jd	|�7}q|Wx6|D].}|jd
�r�|dd�}�j	|�r��j
|�q�W�j
dddd
ddddddg
��jd��jd�t�fdd�d2D��}	|	�r��j
d��r��j|ddgdd��jd|d d!��jd"|d#d!��jd$��r̈j
d%d&g�n:�jd$��s��j
d'd(d)d*d+d,dd-d.g	�n�j
d/d0d1g�dS)3Nzetc/rsyslog.confz/etc/syslog.conf�since�rzUTF-8)�encodingz$IncludeConfig�z^\S+\s+(-?\/.*$)\s+�-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-upgradez/var/log/auth.logzjournalctl --disk-usagezls -alRh /var/log/c3s |]}�j�j|d��VqdS)zlog/journal/N)�path_exists�	path_join)�.0�p)�self��/usr/lib/python3.6/logs.py�	<genexpr>Asz!LogsBase.setup.<locals>.<genexpr>�/var�/runzsystemd-journaldZjournal_fullZjournal_all�d)r�tagsZpriority�thisZjournal_since_boot)ZbootrrZlastZjournal_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.log.1z/var/log/auth.log.2*z/var/log/syslog*z/var/log/kern.log*z/var/log/auth.log*)rr)�
get_optionr�openr�	readlines�
startswith�glob�splitZdo_regex_find_allZpath_isfileZ
add_copy_spec�add_cmd_output�anyZ
is_service�add_journal)
rZrsyslogZconfsrrZconf�line�config�iZjournalr)rr�setupsx


$









zLogsBase.setupcCs|jddd�dS)Nz
/etc/rsyslog*z (ActionLibdbiPassword |pwd=)(.*)z\1[********])Zdo_path_regex_sub)rrrr�postproccszLogsBase.postprocN)rr	r
)�__name__�
__module__�__qualname__Z
short_desc�plugin_name�profilesr*r+rrrrr
s
Orc@seZdZdZdZdZdS)�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.
    rrr	r
N)rr	r
)r,r-r.�__doc__r/r0rrrrr1ks
r1cs,eZdZedddd�gZ�fdd�Z�ZS)�CosLogs�log_days�z"the number of days logs to collect)�name�defaultZdesccs@t�j�|jd�r |jd�n|jdd�}|jd|d�dS)Nrzjournalctl -o exportr4r5z-%ddays)r)�superr*rr$r&)rZdays)�	__class__rrr*�s


z
CosLogs.setup)r,r-r.rZoption_listr*�
__classcell__rr)r9rr3{s
r3)	r"Zsos.report.pluginsrrrrrr1r3rrrr�<module>	s^

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists