a >h@sXddlZddlmZmZmZmZGdddeZGdddeeZGdddeeZdS) N)Plugin PluginOptIndependentPlugin CosPluginc@s(eZdZdZdZdZddZddZdS) LogsBasez System logslogssystemZhardwareZstoragec sd}d|g}g}|r|t|ddd>}|D]$}|dr8|t|d7}q8Wdn1sr0Y|D]0}|sq|}|d|7}q|D].}|d r|dd}|r |q gd  d j d d ddt fdddD}|r~ dr~jddgddjdddjddddr~ ddgdS) Nzetc/rsyslog.conf/etc/syslog.confrzUTF-8)encodingz$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.confz/etc/rsyslog.dr zjournalctl --disk-usagez/var/logTs) recursiveZ extra_optsc3s |]}|dVqdS)z log/journal/N) path_exists path_join).0pself;/usr/lib/python3.9/site-packages/sos/report/plugins/logs.py Asz!LogsBase.setup..)z/varz/runzsystemd-journaldZ journal_fullZ journal_alld)tagsprioritythisZjournal_since_boot)ZbootrlastZjournal_last_bootall_logsz/var/log/journal/*z/run/log/journal/*)ropenr readlines startswithglobsplitZdo_regex_find_allZ path_isfileZ add_copy_specadd_cmd_outputZadd_dir_listinganyZ is_service add_journal get_option) rZrsyslogZconfsrZconflineZconfigiZjournalrrrsetupsF   6         zLogsBase.setupcCs|ddddS)Nz /etc/rsyslog*z (ActionLibdbiPassword |pwd=)(.*)z \1[********])Zdo_path_regex_subrrrrpostprocNs zLogsBase.postprocN)__name__ __module__ __qualname__Z short_desc plugin_nameprofilesr+r,rrrrr s :rc@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. rrN)r-r.r/__doc__r0r1rrrrr2Vs r2cs,eZdZeddddgZfddZZS)CosLogslog-daysz"the number of days logs to collect)namedefaultZdesccsDt|dr |dn |dd}|jd|dddS)Nrzjournalctl -o exportr5r6rdays)Zsince)superr+r(r%r')rr9 __class__rrr+ls     z CosLogs.setup)r-r.r/rZ option_listr+ __classcell__rrr;rr4fs r4) r#Zsos.report.pluginsrrrrrr2r4rrrr sI