§ Rl¾jï ãó€—UddlZddlZddlZddlZddlmZmZdZdZ dZ dZ ej ¦«Z dZed¦«Zdaedzed <d „ed ¦«D¦«d d izZdefd„Zdejfd„Zdefd„Zdd„Zdeddfd„Zdd„Zdedejfd„Ze dœdededdfd„Ze fdededejfd„Ze fdedefd„Z dS)éN)Ú get_log_levelÚinit_subprocess_loggerz4%(asctime)s - %(name)s - %(levelname)s - %(message)sz)/var/log/cloudlinux/lvectl-subprocess.logz/var/log/cloudlinux/lvectl.logÚlvectlé )Újsonzno-iopsÚbytesÚ_running_commandcó—i|] }|d|d›�“Œ S)z\xÚ02x©)Ú.0Úcs úC/opt/cloudlinux/venv/lib64/python3.11/site-packages/cllvectl/log.pyú r0s"€Ð<Ð<Ð<¨1�a˜˜q˜˜˜Ð<Ð<Ð<óé éz\x7fÚreturncót— t|¦« t¦«S#t$rYdSwxYw)zÔEscape control characters so untrusted text cannot forge log records. :param message: value to render into a single-line record :return str: the text with control characters replaced by \xNN escapes z)ÚstrÚ translateÚ_LOG_CONTROL_CHARSÚ Exception)Úmessages rÚsanitize_for_logr3sF€ð +Ý�7‰|Œ|×%Ò%Õ&8Ñ9Ô9Ð9øÝ ð+ð+ð+Ø*Ð*Ð*ð+øøøs ‚&)© 7¶7có4—tjt¦«S)zBThe logger get_synchronous_logger('lvectl') configured, if it ran.©ÚloggingÚ getLoggerÚLVECTL_LOGGER_NAMEr rrÚ_lvectl_loggerr!?s€å Ô Õ/Ñ 0Ô 0Ð0rcó,— tj¦«}n#t$rd}YnwxYw tj¦«}n#t$rd}YnwxYwd} t d|›d�d¦«5}| ¦« dd¦« dd¦« ¦«pd}d d d ¦«n #1swxYwYt|¦«tkr|d t…d z}n#t$rd}YnwxYwd |›d |›d |›�S)aËDescribe this process and the one that invoked it. lvectl is rarely run by hand: cagefsctl loops over it once per user, lveutils-panel-cron drives it every 5 minutes, lvemanager and the selectors shell out to it. "Which of them ran this?" is the first question of most investigations and the answer is not recoverable from the log afterwards. Every step is guarded: this only decorates a log record, so no failure to identify the caller may propagate into the command being reported on. An unidentifiable caller degrades to '?', never to an exception. :return str: 'pid= ppid= parent=', with '?' for any part that could not be determined ú?z/proc/z/cmdlineÚrbóó zutf-8ÚreplaceNz...zpid=z ppid=z parent=) ÚosÚgetpidrÚgetppidÚopenÚreadr'ÚdecodeÚstripÚlenÚ_MAX_PARENT_CMDLINE)ÚpidÚppidÚparentÚfds rÚdescribe_callerr5Ds €ð Ýœ™œˆˆøÝ ðððØˆˆˆðøøøðÝœ*™,œ,ˆˆøÝ ðððØˆˆˆðøøøà €FðÝ Ð)˜4Ð)Ð)Ð)¨4Ñ 0Ô 0ð ^°BØ—W’W‘Y”Y×&Ò& u¨dÑ3Ô3×:Ò:¸7ÀIÑNÔN×TÒTÑVÔVÐ]ÐZ]ˆFð ^ð ^ð ^ñ ^ô ^ð ^ð ^ð ^ð ^ð ^ð ^øøøð ^ð ^ð ^ð ^å ˆv‰;Œ;Õ,Ò ,Ð ,ØÐ0Õ0Ð0Ô1°EÑ9ˆFøøÝ ðððØˆˆˆðøøøà 5�#Ð 5Ð 5˜TÐ 5Ð 5¨6Ð 5Ð 5Ð5sR‚– %¤%©=½ A Á A ÁC9Á&ACÂ7 C9ÃCÃC9à Cà -C9Ã9 DÄDcód—t¦« d|t¦«¦«dS)zlRecord the invocation and who made it. :param argv: the argument list as received, logged verbatim zCalled with args: %s (%s)N)r!Úinfor5)Úargvs rÚlog_invocationr9gs/€õ ÑÔ×ÒÐ5°t½_Ñ=NÔ=NÑOÔOÐOÐOÐOrÚcommandc óþ—|a|rVd d„| ¦«D¦«¦«}t¦« d||¦«dSt¦« d|¦«dS)a\Record a command and the values it resolved its arguments to. log_invocation() says what the caller typed; this says what lvectl made of it -- the uid behind a username, the docroot and domain LVE id behind a domain name, the limits behind a --pmem=1G. Keep the context to values a troubleshooter needs in order to correlate the log with ve.cfg and /proc/lve/map: this runs once per user of a `cagefsctl --isolates-allow-all` sweep. :param str command: command name, also used to name the closing record :param context: resolved values to record, as key=repr pairs ú c3ó*K—|]\}}|›d|›�V—ŒdS)ú=Nr )r ÚkeyÚvalues rú zlog_command..s4èè€ÐPÐP±*°#°u˜cÐ-Ð- EÐ-Ð-ÐPÐPÐPÐPÐPÐPrzRunning command %s: %szRunning command %sN)r ÚjoinÚitemsr!r7)r:ÚcontextÚdetailss rÚ log_commandrFos‚€ðÐØð=Ø—(’(ÐPÐPÀÇ Â ÁÄÐPÑPÔPÑPÔPˆÝÑÔ×ÒÐ6¸ÀÑIÔIÐIÐIÐIåÑÔ×ÒÐ2°GÑ<Ô<Ð<Ð<Ð.�sRèè€ð Jð J�SØ—N’N 3Ñ'Ô'ð JØ,/Õ7HÐ,HÐ,HðØ,HÐ,HÐ,HÐ,Hð Jð Jrérz&Finished %s in %.3fs with exit code %s) r ÚnextÚsysr8r!r7ÚtimeÚ monotonicÚ _STARTED_AT)Ú exit_coder:s rÚ log_finishedrT…s’€õ €GØ€õð Jð J�CœH Q R RœLð Jñ Jô Jà ñ ô ˆõ ÑÔ×ÒÐBØ!¥4¤>Ñ#3Ô#3µkÑ#AÀ9ñNôNðNðNðNrÚnamecó>—tjt›d|›�¦«S)a8Logger for library code whose records belong in lvectl.log. lveapi and lvectllib are shared with other entry points (cllimits, lvemanager, the panel cron), so they must not open lvectl.log themselves. A child of the 'lvectl' logger inherits that logger's handler and level while lvectl is the running program, and is an inexpensive no-op under any other caller -- nothing else configures the 'lvectl' logger, and the root logger has no handlers. :param str name: child name, e.g. 'lveapi' :return logging.Logger: logger instance ú.r)rUs rÚget_lvectl_child_loggerrX—s$€õ Ô Õ 2Ð;Ð;°TÐ;Ð;Ñ <Ô <Ðrvs=ðð€€€€Ø € € € Ø € € € Ø € € € àmÐmÐmÐmÐmÐmÐmÐmðLÐØ!LÐØ6ÐØÐð ˆdŒnÑÔ€ ðÐð�IÐ:Ñ;Ô;Ðð $Ð�#˜‘*Ð#Ð#Ñ#ð=Ð<°°°d± ´ Ð<Ñ<Ô<ÀÀg¸ÑNÐð + ð +ð +ð +ð +ð1˜œð1ð1ð1ð1ð 6˜ð 6ð 6ð 6ð 6ðFPðPðPðPð=˜ð=¨Dð=ð=ð=ð=ð,NðNðNðNð$ = #ð =¨'¬.ð =ð =ð =ð =ð ?Rððð¨ð¸ðÐVZððððð*7Uð8ð8 ð8°ð8ÐY`ÔYgð8ð8ð8ð8ð8Kð ð  ð °ð ð ð ð ð ð r