-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtractMessagesFromBnetLog.sh
More file actions
executable file
·76 lines (52 loc) · 7.82 KB
/
ExtractMessagesFromBnetLog.sh
File metadata and controls
executable file
·76 lines (52 loc) · 7.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
export DATE_FORMAT="[0-9]*/[0-9]*/[0-9]* [0-9]*:[0-9]*:[0-9]*:[0-9]*"
export FILENAME=${1}
export FOLDERNAME=$(dirname ${FILENAME})
export EXTRA_FILTER="${2}"
export FILTER=".*SIP_Utils\.cc\.75|.*########## SIPMessage ##########"
#cat ${FILENAME} | ~/dev-newton/scripts/grep.multiline.pl "\[${DATE_FORMAT}]" "SIPCallLeg::AddRouteHeadersFromRecordRoute out_msg ########## SIPMessage ##########|REceived message is ########## SIPMessage ##########|B2BCallLeg::MsgToSendEvent.*########## SIPMessage ##########" > ${FOLDERNAME}/Messages.log;
#cat ${FOLDERNAME}/Messages.log | ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "^\[\(${DATE_FORMAT}\)\].*REceived message is ########## SIPMessage ##########" "\[\1\] NOTE_OVER_RECEIVED \\n\1" | ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "^\[\(${DATE_FORMAT}\)\].*B2BCallLeg::MsgToSendEvent.*########## SIPMessage ##########" "\[\1\] NOTE_OVER_SENT \\n\1" | ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "^\[\(${DATE_FORMAT}\)\].*SIPCallLeg::AddRouteHeadersFromRecordRoute out_msg ########## SIPMessage ##########" "\[\1\] NOTE_OVER_SENT \\n\1" > ${FOLDERNAME}/Messages.log.note
#grep -e "Call-ID:" ${FOLDERNAME}/Messages.log | sort | uniq | ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "Call-ID:\([\ 0-9a-zA-Z\-]*\).*" '| ~/dev-newton/scripts/search.and.replace.multiline.pl \\"^\\\\[${DATE_FORMAT}\\\\]\\" \\"Call-ID:\1\\" \\"NOTE_OVER_RECEIVED\\" \\"note over \1#yellow:\\" | ~/dev-newton/scripts/search.and.replace.multiline.pl \\"^\\\\[${DATE_FORMAT}\\\\]\\" \\"Call-ID:\1\\" \\"NOTE_OVER_SENT\\" \\"note over \1#pink:\\"' |
#xargs echo "cat ${FOLDERNAME}/Messages.log.note" | sh | fold -w 140 > ${FOLDERNAME}/Messages.log.updated
#grep -e "Call-ID:" ${FOLDERNAME}/Messages.log.updated | sort | uniq | ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "Call-ID:\([\ 0-9a-zA-Z\-]*\).*" '| ~/dev-newton/scripts/search.and.replace.multiline.pl \\"^\\\\[${DATE_FORMAT}\\\\]\\" \\"Call-ID:\1\\" \\"\\\\n|\\\\r\\" \\"\\\\\\\\n\\"' |
#xargs echo "cat ${FOLDER-NAME}/Messages.log.updated" | sh > ${FOLDERNAME}/Messages.log.updated.1
#cat ${FOLDERNAME}/Messages.log.updated.1 | ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "\[${DATE_FORMAT}\]" "\n"| ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "\\\\n\\\\n" "\\\\n" > ${FOLDERNAME}/Messages.flow.log;
##### Grep All messages #############
if [ "${EXTRA_FILTER}" != "" ]; then
export FILTER=${FILTER}+"|${EXTRA_FILTER}";
fi
#cat ${FILENAME} | ~/dev-newton/scripts/grep.multiline.pl "\[${DATE_FORMAT}]" ".*PIN HOLE ##########|.*SIP_Utils\.cc\.75|.*########## SIPMessage ##########" > ${FOLDERNAME}/Messages.pinholes;
cat ${FILENAME} | ~/dev-newton/scripts/grep.multiline.pl -ss "\[${DATE_FORMAT}]" -g "${FILTER}" > ${FOLDERNAME}/Messages.log.all;
cat ${FOLDERNAME}/Messages.log.all \
| ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "^\[\(${DATE_FORMAT}\)\].*REceived message is ########## SIPMessage ##########" "\[\1\] NOTE_OVER_RECEIVED \\n\1" \
| ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "^\[\(${DATE_FORMAT}\)\].*B2BCallLeg::MsgToSendEvent.*########## SIPMessage ##########" "\[\1\] NOTE_OVER_SENT \\n\1" \
| ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "^\[\(${DATE_FORMAT}\)\].*SIPCallLeg::AddRouteHeadersFromRecordRoute out_msg ########## SIPMessage ##########" "\[\1\] NOTE_OVER_SENT \\n\1" \
| ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "^\[\(${DATE_FORMAT}\)\].*SIP_Utils\.cc\.75.*" "\[\1\] NOTE_OVER_MESSAGE \\n\1" \
| ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "^\[\(${DATE_FORMAT}\)\].*########## SIPMessage ##########" "\[\1\] NOTE_OVER_MESSAGE \\n\1" \
> ${FOLDERNAME}/Messages.log.all.note.pre
cat ${FOLDERNAME}/Messages.log.all.note.pre > ${FOLDERNAME}/Messages.log.all.note;
if [ "${EXTRA_FILTER}" != "" ]; then
cat ${FOLDERNAME}/Messages.log.all.note.pre \
| ~/dev-newton/scripts/search.and.replace.multiline.pl "^\[${DATE_FORMAT}\]" "${EXTRA_FILTER}" "^\[${DATE_FORMAT}\]" ""\
> ${FOLDERNAME}/Messages.log.all.note;
fi
cat ${FOLDERNAME}/Messages.log.all.note > ${FOLDERNAME}/Messages.log.all.updated;
grep -e "Call-ID:" ${FOLDERNAME}/Messages.log.all | sort | uniq |
~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "Call-ID:\([\ 0-9a-zA-Z\-]*\).*" 'cat ${FOLDERNAME}/Messages.log.all.updated | ~/dev-newton/scripts/search.and.replace.multiline.pl "^\\[${DATE_FORMAT}\\]" "Call-ID:\1" "NOTE_OVER_MESSAGE" "note over\1#lightgreen:" \> ${FOLDERNAME}/Messages.log.all.updated.tmp; mv ${FOLDERNAME}/Messages.log.all.updated.tmp ${FOLDERNAME}/Messages.log.all.updated' |sh
grep -e "Call-ID:" ${FOLDERNAME}/Messages.log.all | sort | uniq |
~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "Call-ID:\([\ 0-9a-zA-Z\-]*\).*" 'cat ${FOLDERNAME}/Messages.log.all.updated | ~/dev-newton/scripts/search.and.replace.multiline.pl "^\\[${DATE_FORMAT}\\]" "Call-ID:\1" "NOTE_OVER_RECEIVED" "note over\1#yellow:" \> ${FOLDERNAME}/Messages.log.all.updated.tmp; mv ${FOLDERNAME}/Messages.log.all.updated.tmp ${FOLDERNAME}/Messages.log.all.updated' |sh
grep -e "Call-ID:" ${FOLDERNAME}/Messages.log.all | sort | uniq |
~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "Call-ID:\([\ 0-9a-zA-Z\-]*\).*" 'cat ${FOLDERNAME}/Messages.log.all.updated | ~/dev-newton/scripts/search.and.replace.multiline.pl "^\\[${DATE_FORMAT}\\]" "Call-ID:\1" "NOTE_OVER_SENT" "note over\1#pink:" \> ${FOLDERNAME}/Messages.log.all.updated.tmp; mv ${FOLDERNAME}/Messages.log.all.updated.tmp ${FOLDERNAME}/Messages.log.all.updated' |sh
cat ${FOLDERNAME}/Messages.log.all.updated | fold -w 140 > ${FOLDERNAME}/Messages.log.all.updated.tmp; mv ${FOLDERNAME}/Messages.log.all.updated.tmp ${FOLDERNAME}/Messages.log.all.updated;
#export MSGLIST1=$(grep -e "Call-ID:" ${FOLDERNAME}/Messages.log.all | sort | uniq |
#~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "Call-ID:\([\ 0-9a-zA-Z\-]*\).*" '| ~/dev-newton/scripts/search.and.replace.multiline.pl \\"^\\\\[${DATE_FORMAT}\\\\]\\" \\"Call-ID:\1\\" \\"NOTE_OVER_MESSAGE\\" \\"note over \1#lightgreen:\\"');
#export MSGLIST2=$(grep -e "Call-ID:" ${FOLDERNAME}/Messages.log.all | sort | uniq |
#~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "Call-ID:\([\ 0-9a-zA-Z\-]*\).*" '| ~/dev-newton/scripts/search.and.replace.multiline.pl \\"^\\\\[${DATE_FORMAT}\\\\]\\" \\"Call-ID:\1\\" \\"NOTE_OVER_RECEIVED\\" \\"note over \1#yellow:\\"');
#export MSGLIST3=$(grep -e "Call-ID:" ${FOLDERNAME}/Messages.log.all | sort | uniq |
#~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "Call-ID:\([\ 0-9a-zA-Z\-]*\).*" '| ~/dev-newton/scripts/search.and.replace.multiline.pl \\"^\\\\[${DATE_FORMAT}\\\\]\\" \\"Call-ID:\1\\" \\"NOTE_OVER_SENT\\" \\"note over \1#pink:\\"');
#echo ${MSGLIST1} ${MSGLIST2} ${MSGLIST3} | xargs echo "cat ${FOLDERNAME}/Messages.log.all.note" | sh -x | fold -w 140 > ${FOLDERNAME}/Messages.log.all.updated
#grep -e "Call-ID:" ${FOLDERNAME}/Messages.log.all.updated | sort | uniq | ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "Call-ID:\([\ 0-9a-zA-Z\-]*\).*" '| ~/dev-newton/scripts/search.and.replace.multiline.pl \\"^\\\\[${DATE_FORMAT}\\\\]\\" \\"Call-ID:\1\\" \\"\\\\n|\\\\r\\" \\"\\\\\\\\n\\"' |
#xargs echo "cat ${FOLDERNAME}/Messages.log.all.updated" | sh > ${FOLDERNAME}/Messages.log.all.updated.1
cat ${FOLDERNAME}/Messages.log.all.updated | ~/dev-newton/scripts/search.and.replace.multiline.pl "^\[${DATE_FORMAT}\]" ".*" "\n|\r" "\\n"> ${FOLDERNAME}/Messages.log.all.updated.1
cat ${FOLDERNAME}/Messages.log.all.updated.1 | ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "\[${DATE_FORMAT}\]" "\n"| ~/dev-newton/scripts/NoFileCreationReplaceFileList.sh "\\\\n\\\\n" "\\\\n" > ${FOLDERNAME}/Messages.all.flow.log;
grep -v " OPTIONS" ${FOLDERNAME}/Messages.all.flow.log > ${FOLDERNAME}/Messages.all.flow.log.nooptions
grep -v " REGISTER" ${FOLDERNAME}/Messages.all.flow.log.nooptions > ${FOLDERNAME}/Messages.all.flow.log.nooptions.noregister