Thomas Vachuska
Committed by Gerrit Code Review

Enhanced onos-log to allow remotely grepping through the logs. usage: onos-log […

…-l] [remote-ip [{karaf-instance-id|-} [ere-pattern]]]

Change-Id: I598f0f5dd5f7f5436c0459f93944d0303cfa355e
...@@ -15,13 +15,17 @@ remote=$(find_node $1) ...@@ -15,13 +15,17 @@ remote=$(find_node $1)
15 remote=$ONOS_USER@${remote:-$OCI} 15 remote=$ONOS_USER@${remote:-$OCI}
16 instance=$2 16 instance=$2
17 17
18 -[ -n "$instance" ] && \ 18 +pattern=$3
19 +
20 +[ -n "$instance" -a "$instance" != "-" ] && \
19 LOG=$ONOS_INSTALL_DIR/$KARAF_DIST/instances/$instance/data/log/karaf.log || \ 21 LOG=$ONOS_INSTALL_DIR/$KARAF_DIST/instances/$instance/data/log/karaf.log || \
20 LOG=$ONOS_INSTALL_DIR/log/karaf.log 22 LOG=$ONOS_INSTALL_DIR/log/karaf.log
21 23
22 24
23 if [ $less -eq 1 ]; then 25 if [ $less -eq 1 ]; then
24 ssh -t $remote "less $LOG" 26 ssh -t $remote "less $LOG"
27 +elif [ -n "$pattern" ]; then
28 + ssh $remote "grep $LOG -Ee \"$pattern\""
25 else 29 else
26 ssh -t $remote " 30 ssh -t $remote "
27 while true; do 31 while true; do
......