summary refs log tree commit diff
path: root/svlogtail
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2014-07-18 23:38:18 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2014-07-18 23:38:18 +0200
commite806a9b14fc826ddd74d90f55a20a372d130ea48 (patch)
tree59d20e9308388d3e08cdf9d3563f80e39e356ae7 /svlogtail
parentb0368aad76ce3b67f6050855f9a43cc7bb2d1dc3 (diff)
downloadsocklog-void-e806a9b14fc826ddd74d90f55a20a372d130ea48.tar.gz
socklog-void-e806a9b14fc826ddd74d90f55a20a372d130ea48.tar.xz
socklog-void-e806a9b14fc826ddd74d90f55a20a372d130ea48.zip
add svlogtail
Diffstat (limited to 'svlogtail')
-rwxr-xr-xsvlogtail23
1 files changed, 23 insertions, 0 deletions
diff --git a/svlogtail b/svlogtail
new file mode 100755
index 0000000..f61f262
--- /dev/null
+++ b/svlogtail
@@ -0,0 +1,23 @@
+#!/bin/sh
+# svlogtail [LOGS...] - show svlogd logs conveniently
+#
+# Without arguments, show current logs of all services, uniquely.
+# With arguments, show all logs of mentioned services.
+
+if [ $# = 0 ]; then
+	cat /var/log/socklog/*/current | sort -u
+	tail -Fq -n0 /var/log/socklog/*/current | uniq
+else
+	old=
+	cur=
+	for log; do
+		if [ -d /var/log/socklog/$log ]; then
+			old="$old /var/log/socklog/$log/*.[us]"
+			cur="$cur /var/log/socklog/$log/current"
+		else
+			echo "no logs for $log" 1>&2
+		fi
+	done
+	cat $old $cur | sort
+	tail -Fq -n0 $cur
+fi