MOON
Server: Apache
System: Linux server.royaltuning.hu 4.18.0-425.13.1.el8_7.x86_64 #1 SMP Tue Feb 21 04:20:52 EST 2023 x86_64
User: royaltuning (1001)
PHP: 8.2.32
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3.6/site-packages/sos/report/plugins/__pycache__/logs.cpython-36.pyc
3

�&'j��@shddlZddlZddlZddlmZmZmZmZGdd�de�ZGdd�dee�Z	Gdd�dee�Z
dS)	�N)�Plugin�	PluginOpt�IndependentPlugin�	CosPluginc@s(eZdZdZdZdZdd�Zdd	�Zd
S)�LogsBasezSystem logs�logs�system�hardware�storagecsJd}d|g}g}�j|��rt�j|�ddd���}|j�}x�tjd|tjtjBd�D]�}yP|d}|jd	�r�t	j
|j�d
jd��}|r�|t
j
|�7}n|t
j
|�7}WqTtk
r�}	z�jd|	���WYdd}	~	XqTXqTWx0|j�D]$}
|
jd
�r�|t
j
|
j�d
�7}q�WWdQRXx>|D]6}�j�j|���s<�q"�j|�}|�jd|�7}�q"Wx<|D]4}|jd��r~|d
d�}�j|��rb�j|��qbW�jddddddddddddg��jd��jdddd�t�fdd �d0D��}
|
�rF�jd#��rF�jd$d%gd&d'��jd(d)d*��jd+d,d*��jd-��rF�jd.d/g�dS)1Nz/etc/rsyslog.confz/etc/syslog.conf�rzUTF-8)�encodingz-(include\((\s*)?file=([\"'`]([^'\"]*)[\"'`])))�pattern�string�flags�zecho �z $`zError parsing include(): z$IncludeConfigz^\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.dzjournalctl --disk-usagez/var/logT�s)�	recursiveZ
extra_optsc3s |]}�j�j|d��VqdS)zlog/journal/N)�path_exists�	path_join)�.0�p)�self��/usr/lib/python3.6/logs.py�	<genexpr>Vsz!LogsBase.setup.<locals>.<genexpr>�/var�/runzsystemd-journaldZjournal_fullZjournal_all�d)�tagsZpriority�thisZjournal_since_boot)Zbootr ZlastZjournal_last_boot�all_logsz/var/log/journal/*z/run/log/journal/*)rr)r�openr�read�re�findall�I�M�
startswith�os�getenv�split�strip�glob�	ExceptionZ
_log_debug�
splitlinesZdo_regex_find_allZpath_isfileZ
add_copy_spec�add_cmd_outputZadd_dir_listing�anyZ
is_service�add_journal�
get_option)rZrsyslogZconfsrZconfZcontent�matchZ_entZenvc�err�line�config�iZjournalr)rr�setupst
&
$





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;rrrrrs
Mrc@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?r@rrrrrAks
rAcs,eZdZedddd�gZ�fdd�Z�ZS)�CosLogszlog-daysrz"the number of days logs to collect)�name�defaultZdesccsDt�j�|jd�r |jd�n |jdd�}|jd|�d�d�dS)Nr"zjournalctl -o exportzlog-daysrr�days)Zsince)�superr:r4r1r3)rrF)�	__class__rrr:�s


z
CosLogs.setup)r<r=r>rZoption_listr:�
__classcell__rr)rHrrC{s
rC)r.r*r%Zsos.report.pluginsrrrrrrArCrrrr�<module>	s\