I have a dante socks log file and trying to a way out to parse getting two parts and seperate them with a semicolon.
Log File contains:
Sep 11 03:02:00 (1568505720.145620) danted[10402]: info: pass(2): tcp/connect -: pam.username%[email protected] 123.12.12.112.1080 -> 123.12.12.112.48198 111.123.123.147.443 (319721)
Sep 11 03:02:00 (1568505720.147471) danted[10402]: info: pass(2): tcp/connect -: pam.username%[email protected] 123.12.12.112.1080 -> 123.12.12.112.37449 123.123.123.211.443 (312)
Sep 11 03:02:00 (1568505720.148240) danted[10402]: info: pass(2): tcp/connect -: 111.123.123.147.443 123.12.12.112.48198 -> 123.12.12.112.1080 pam.username%[email protected] (723)
Sep 11 03:02:00 (1568505720.154784) danted[10402]: info: pass(2): tcp/connect -: 123.123.123.211.443 123.12.12.112.37449 -> 123.12.12.112.1080 pam.username%[email protected] (8831)
Basicly, I want to get after pam.username% to fetch to username and data rate inside of two parenthesise like 8831 so end up something like below:
MyUsername;319721
MyUsername;312
MyUsername;723
MyUsername;8831
I guess awk and sed/regex knowledge would be great at that point.
Thanks in advance,
Try using the following regex:
Regex Demo
Explanation:
Access the username via Group 1, and the data rate via Group 2.