CORD-962: Fixed logstash_tail so that it does not crash early on in the
build process. Also fixed a line counting issue.
Change-Id: I17a777771c7eb1ee022f4b0194d2231958ba706b
diff --git a/elk-logger/logstash_tail b/elk-logger/logstash_tail
index 3543011..a4d6f29 100755
--- a/elk-logger/logstash_tail
+++ b/elk-logger/logstash_tail
@@ -79,6 +79,7 @@
payload = {'desc':payload, 'global_tag': g}
send_log(payload)
+ #print payload
def run_logger():
lst = []
@@ -109,17 +110,19 @@
break
inp += l
- lc += 1
+ lc = len(inp.split('\n'))
if (lc>4):
top = inp.splitlines()[0]
- line_idx = inp.index('\n')
- inp=inp[line_idx+1:]
+ try:
+ line_idx = inp.index('\n')
+ inp=inp[line_idx+1:]
- g,top = extract_global(top)
- report(top,g)
-
- lc-=1
+ g,top = extract_global(top)
+ report(top,g)
+ lc = len(inp.split('\n'))
+ except ValueError:
+ pass
try:
s = xos_logger.scanString(inp)