Hi ,
2/17/2017 16:11:14 hostname some text some text
2/17/2017 16:11:14 hostname Filename !!Begin test: Scriptname: abcTest/output/outputfile.log
2/17/2017 16:11:14 hostname Filename test data test data test data test data
2/17/2017 16:11:14 hostname >> test data test data
2/17/2017 16:11:14 hostname >> exception after this line1
2/17/2017 16:11:14 hostname << exception after this line2
2/17/2017 16:11:14 hostname << exception after this line3
2/17/2017 16:11:14 hostname Filename not found exception
2/17/2017 16:11:14 hostname Filename test data test data test data test data
2/17/2017 16:11:14 hostname Filename test data test data test data test data
2/17/2017 16:11:14 hostname testing test data test dat
2/17/2017 16:11:14 hostname Knowledge Base:data
2/17/2017 16:11:14 hostname FAIL: Testcase completed :setup() has failed
2/17/2017 16:11:14 hostname Filename test data test data test data test data
I have to parse these kinds of log files.This is a single log file.
In this log i have to read three different line.
1.2/17/2017 16:11:14 hostname Filename !!Begin test: Scriptname: abcTest/output/outputfile.log
to extract text after Filename !!Begin test:
- 2/17/2017 16:11:14 hostname Knowledge Base:data
2/17/2017 16:11:14 hostname FAIL: Testcase completed :setup() has failed
read these lines as a single line and then check some condition and then extract text after FAIL: Testcase completed :setup() has failed
2/17/2017 16:11:14 hostname << exception after this line
2/17/2017 16:11:14 hostname Filename not fount exception
check if "<< " is the last occurence of then read next line.
I have to save this data in a csv file to i am planning to use
file{
codec => line{ format => "%{field1},{field2}"}
path => "output.csv"
}
Please advice how should i proceed for this.-
-
should i use multiple grok and in each grok i read different pattern then in output i take the required fields only.
-
Can I merge the whole file in a single line then read the read the required text.
because i want to read different lines of single file having different pattern and then output in a single row
Please advice this urgent.
Thanks