Created
August 2, 2016 07:15
-
-
Save fortitudepub/19ec6a6b3d2eb9612009493f05cb6bb1 to your computer and use it in GitHub Desktop.
A awk source code to extract some useful logline from log data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
net2req["id1"] = "req1" | |
allreq["req1"] = "req1" | |
} | |
# 1. found received rpc named 'network_sync', extracted req-id and store it to associative arrays. | |
# print the line | |
# 2. found arg dropped for the req-id, print the line | |
# 3. found notify agen add-fdb, delete the req-id in the associative array, print the line | |
{ | |
# 1. | |
if ( /u'method': u'network_sync'/ ) { | |
#print $0 | |
{ | |
match($11, /u'(req.+)',/, reqarr) | |
match($18, /u'(.+)',/, netarr) | |
#net2req[netarr[1]] = reqarr[1] | |
#allreq[reqarr[1]] = "present" | |
print $1, $2, "req+net",reqarr[1],netarr[1] | |
} | |
} | |
# 2. | |
if ( /Arguments dropped/ ) { | |
#print $0 | |
{ | |
match($6, /\[(req.+)/, reqarr) | |
print $1, $2, "arg dropped", reqarr[1] | |
} | |
} | |
# 3. | |
if ( /Notify l2population/ ) { | |
{ | |
match($6, /\[(req.+)/, reqarr) | |
match($19, /{u'(.+)':/, netarr) | |
print $1, $2, "notify l2pop, req+net", reqarr[1], netarr[1] | |
} | |
} | |
} | |
END { | |
# for (nid in net2req) { | |
# print nid | |
# print net2req[nid] | |
# } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment