alterator-logs-0.4/ 0000755 0000000 0000000 00000000000 11116216270 0014307 5 ustar 00root root 0000000 0000000 alterator-logs-0.4/Makefile 0000644 0000000 0000000 00000000370 11116216270 0015747 0 ustar 00root root 0000000 0000000 NAME=logs DESCRIPTION="System logs" INSTALL=/usr/bin/install all: clean: install: install-module install-data include /usr/share/alterator/build/module.mak install-data: install -d $(sysconfdir)/alterator cp -a logs $(sysconfdir)/alterator alterator-logs-0.4/applications/ 0000755 0000000 0000000 00000000000 11116216270 0016775 5 ustar 00root root 0000000 0000000 alterator-logs-0.4/applications/logs.desktop 0000644 0000000 0000000 00000000225 11116216270 0021333 0 ustar 00root root 0000000 0000000 [Desktop Entry] Type=Application Categories=X-Alterator-System Icon=logs Terminal=false Name=System logs X-Alterator-URI=/logs X-Alterator-Help=logs alterator-logs-0.4/backend3/ 0000755 0000000 0000000 00000000000 11116216270 0015761 5 ustar 00root root 0000000 0000000 alterator-logs-0.4/backend3/logs 0000755 0000000 0000000 00000006136 11116216270 0016661 0 ustar 00root root 0000000 0000000 #!/bin/sh datadir=/etc/alterator/logs cachefile=/var/cache/alterator/alterator-logs.txt po_domain="alterator-logs" . alterator-sh-functions log_basename() { local n=${1##*/} echo "${n%%.desktop}" } desktop_awk() { [ ! -f "$1" ] || alterator-dump-desktop \ -v lang="$in_language" \ -v out="X-Alterator-URI;Name" \ -v def="/notfound;" \ $1 } cat_log() { find "$(dirname $1)" -type f -name "$(basename $1)*"| while read f; do t="$(file -b "$f")" if [ -z "${t##bzip2 compressed data*}" ]; then bzcat "$f" elif [ -z "${t##gzip compressed data*}" ]; then zcat "$f" else cat "$f" fi done } on_message() { case "$in_action" in write) write_nop ;; read) echo '(' local name="$in_name" local desktopfile="$datadir/$name.desktop" if [ ! -n "$name" ] ;then desktopfile="$(find "$datadir" -name '*.desktop'|head -n1)" name="$(log_basename "$desktopfile")" fi #dump + total size local path="$(desktop_awk "$desktopfile"|cut -f1)" local total="$(cat_log "$path"|tee "$cachefile"|wc -l)" #main data: page size and start shift local start="$in_start" local size="$in_size" local stop= [ -n "$size" ] || size=20 [ -n "$start" ] || start=1 #change size: back to first page if [ -n "$in_new_size" -a "$in_new_size" != "$in_size" ];then size="$in_new_size" start=1 fi #next/back/first/last if [ -n "$in_next" ]; then start="$(($start + $size))" fi if [ -n "$in_back" ]; then start="$(($start - $size))" [ "$start" -gt 0 ] || start=1 fi if [ -n "$in_first" ]; then start=1 fi if [ -n "$in_last" ]; then start="$(( ( $total / $size ) * $size ))" [ "$start" -gt 0 ] || start=1 stop="$total" else stop="$(($start + $size))" fi printf 'text "%s"' "$(sed -n -e "$start,$stop p" -e "$stop q" "$cachefile"|string_quote)" [ "$stop" -lt "$total" ] || stop="$total" local format="`_ "Lines %s-%s of %s"`" printf "range \"$format\"\n" "$start" "$stop" "$total" #save information for next page switch if [ "$stop" -eq "$total" ] ;then start="$(($start - $size))" [ "$start" -gt 0 ] || start=1 fi printf 'name "%s"\n' "$name" printf 'start "%s"\n' "$start" printf 'size "%s"\n' "$size" printf 'new_size "%s"\n' "$size" echo ')' ;; list) echo '(' case "$in__objects" in avail_size) write_enum_item "10" "`_ "10 lines"`" write_enum_item "20" "`_ "20 lines"`" write_enum_item "50" "`_ "50 lines"`" write_enum_item "100" "`_ "100 lines"`" ;; avail_log) find "$datadir" -name '*.desktop'| while read n;do printf '%s\t' "$(log_basename "$n")" desktop_awk "$n" done| while read desktopfile path description;do [ -f "$path" ] || continue write_enum_item "$desktopfile" "$description" done ;; esac echo ')' ;; *) echo '#f' ;; esac } message_loop alterator-logs-0.4/design/ 0000755 0000000 0000000 00000000000 11116216270 0015560 5 ustar 00root root 0000000 0000000 alterator-logs-0.4/design/scripts/ 0000755 0000000 0000000 00000000000 11116216270 0017247 5 ustar 00root root 0000000 0000000 alterator-logs-0.4/design/scripts/logs/ 0000755 0000000 0000000 00000000000 11116216270 0020213 5 ustar 00root root 0000000 0000000 alterator-logs-0.4/design/scripts/logs/select.js 0000644 0000000 0000000 00000000607 11116216270 0022033 0 ustar 00root root 0000000 0000000 function LogsAutoSubmit(name) { var view = document.getElementById(name); var select = document.getElementById("select-"+name); if (!view || !select) return; view.style.display="none"; addEvent(select,'change',function() { select.form.submit(); }); } function initLogs() { LogsAutoSubmit("view"); LogsAutoSubmit("change"); } addEvent(window,'load',initLogs); alterator-logs-0.4/logs/ 0000755 0000000 0000000 00000000000 11116216270 0015253 5 ustar 00root root 0000000 0000000 alterator-logs-0.4/logs/ahttpd.desktop 0000644 0000000 0000000 00000000327 11116216270 0020134 0 ustar 00root root 0000000 0000000 [Desktop Entry] Type=Application Categories=X-Alterator-Xorg Icon=configd Terminal=false Name=Web interface HTTP server Name[ru]=HTTP-сервер web-интерфейса X-Alterator-URI=/var/log/ahttpd/access.log alterator-logs-0.4/logs/configd.desktop 0000644 0000000 0000000 00000000314 11116216270 0020255 0 ustar 00root root 0000000 0000000 [Desktop Entry] Type=Application Categories=X-Alterator-Xorg Icon=configd Terminal=false Name=System configurator Name[ru]=Системный конфигуратор X-Alterator-URI=/var/log/configd.log alterator-logs-0.4/logs/kernel.desktop 0000644 0000000 0000000 00000000233 11116216270 0020124 0 ustar 00root root 0000000 0000000 [Desktop Entry] Type=Application Categories=X-Alterator-Xorg Icon=secure Terminal=false Name=Kernel Name[ru]=Ядро X-Alterator-URI=/var/log/kernel/info alterator-logs-0.4/logs/messages.desktop 0000644 0000000 0000000 00000000306 11116216270 0020454 0 ustar 00root root 0000000 0000000 [Desktop Entry] Type=Application Categories=X-Alterator-Xorg Icon=configd Terminal=false Name=System messages Name[ru]=Системные сообщения X-Alterator-URI=/var/log/syslog/messages alterator-logs-0.4/logs/secure.desktop 0000644 0000000 0000000 00000000255 11116216270 0020136 0 ustar 00root root 0000000 0000000 [Desktop Entry] Type=Application Categories=X-Alterator-Xorg Icon=secure Terminal=false Name=Security Name[ru]=Безопасность X-Alterator-URI=/var/log/auth/secure alterator-logs-0.4/templates/ 0000755 0000000 0000000 00000000000 11116216270 0016305 5 ustar 00root root 0000000 0000000 alterator-logs-0.4/templates/logs/ 0000755 0000000 0000000 00000000000 11116216270 0017251 5 ustar 00root root 0000000 0000000 alterator-logs-0.4/templates/logs/index.html 0000644 0000000 0000000 00000002430 11116216270 0021245 0 ustar 00root root 0000000 0000000
alterator-logs-0.4/ui/ 0000755 0000000 0000000 00000000000 11116216270 0014724 5 ustar 00root root 0000000 0000000 alterator-logs-0.4/ui/logs/ 0000755 0000000 0000000 00000000000 11116216270 0015670 5 ustar 00root root 0000000 0000000 alterator-logs-0.4/ui/logs/index.scm 0000644 0000000 0000000 00000002766 11116216270 0017516 0 ustar 00root root 0000000 0000000 (document:surround "/std/frame") (document:insert "/std/functions") (define *start* (make-cell 1)) (define *size* (make-cell 1)) ;;; Functions (define (do-apply data) (cell-set! *start* (woo-get-option data 'start)) (cell-set! *size* (woo-get-option data 'size)) (txt text (woo-get-option data 'text)) (range text (woo-get-option data 'range))) (define (do-update . args) (woo-catch/message (thunk (do-apply (apply woo-read-first "/logs" 'start (cell-ref *start*) 'size (cell-ref *size*) 'name (log value) args))))) ;;; UI (hbox align "left" (label text (_ "Logs:")) (document:id log (combobox (when selected (do-update))))) (document:id txt (textbox)) (hbox align "left" (document:id range (label)) (button text (_ "Previous") (when clicked (do-update 'back #t))) (button text (_ "Next") (when clicked (do-update 'next #t))) (label) (button text (_ "First page") (when clicked (do-update 'first #t))) (button text (_ "Last page") (when clicked (do-update 'last #t))) (label text "|") (label text (_ "Show:")) (document:id new_size (combobox (when selected (do-update 'new_size (new_size value)))))) ;;; Logic (document:root (when loaded (woo-catch/message (thunk (let ((data (woo-read-first "/logs"))) (log enumref "/logs/avail_log" value (woo-get-option data 'name)) (new_size enumref "/logs/avail_size" value (woo-get-option data 'new_size)) (do-apply data))))))