o id@sXddlZddlmZmZmZmZGdddeZGdddeeZGdddeeZdS) N)Plugin PluginOptIndependentPlugin CosPluginc@s(eZdZdZdZdZddZddZdS) LogsBasez System logslogssystemhardwarestoragec sddg}g}d}dr?tdd}|D]}|dr/|t|d7}qWdn1s:wY|D]}|sLqA|}|d|7}qA|D]}|dri|dd} |rs |q\ gd  d  d t fd d dD}|r drj|ddgddjd|ddjd|dddr ddgdSdSdsψ gddS gddS)N/etc/syslog.conf/etc/rsyslog.confsincerz$IncludeConfigz^\S+\s+(-?\/.*$)\s+-) r r z/etc/rsyslog.dz/var/log/boot.logz/var/log/installerz/var/log/messages*z/var/log/secure*z /var/log/udevz/var/log/dist-upgradezjournalctl --disk-usagezls -alRh /var/log/csg|] }|dqS)z log/journal/) path_exists path_join).0pself9/usr/lib/python3/dist-packages/sos/report/plugins/logs.py ?sz"LogsBase.setup..)z/varz/runzsystemd-journald journal_full journal_alld)rtagsprioritythisjournal_since_boot)bootrrlastjournal_last_bootall_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.logz/var/log/auth.log.1z/var/log/auth.log.2*)z/var/log/syslog*z/var/log/kern.log*z/var/log/auth.log*) get_optionropenr readlines startswithglobsplitdo_regex_find_all path_isfile add_copy_specadd_cmd_outputany is_service add_journal) rconfsrrconflineconfigijournalrrrsetups^                zLogsBase.setupcCs|ddddS)Nz /etc/rsyslog*z (ActionLibdbiPassword |pwd=)(.*)z \1[********])do_path_regex_subrrrrpostprocas zLogsBase.postprocN)__name__ __module__ __qualname__ short_desc plugin_nameprofilesr9r;rrrrr s  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. rrN)r<r=r>__doc__r@rArrrrrBis rBcs,eZdZeddddgZfddZZS)CosLogslog_daysz"the number of days logs to collect)namedefaultdesccsFtt||dr|ddS|dd}|jd|ddS)Nr%zjournalctl -o exportrErFz-%ddays)r)superrDr9r&r/r2)rdays __class__rrr9s   z CosLogs.setup)r<r=r>r option_listr9 __classcell__rrrLrrDys rD) r*sos.report.pluginsrrrrrrBrDrrrrs \