From 70212da3cbc7d7f78c4d72150bb9eda387aca39a Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Wed, 20 Dec 2023 17:51:35 +0900 Subject: [PATCH] systemd logs end with dot and we split, so we missed user names with . inside --- bin/collect_login_data.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/collect_login_data.sh b/bin/collect_login_data.sh index 0a5e1ce..de8bc24 100755 --- a/bin/collect_login_data.sh +++ b/bin/collect_login_data.sh @@ -61,7 +61,8 @@ function parseLog() if [ "${logger}" = "systemd" ]; then # 2022-11-18T20:04:08+0900 auth_date=$(echo "${line}" | cut -d " " -f 1); - auth_user=$(echo "${line}" | cut -d "]" -f 2 | cut -d " " -f 7 | cut -d "." -f 1); + # Note, instead of cut with dot, remove last dot in line + auth_user=$(echo "${line}" | cut -d "]" -f 2 | cut -d " " -f 7 | sed -e "s/\.$//"); else auth_date=$(echo "${line}" | cut -c 1-6)" ${start_year} "$(echo "${line}" | cut -c 8-15); auth_user=$(echo "${line}" | cut -d ")" -f 2 | cut -d " " -f 6 | cut -d "(" -f 1);