Commit 41778413 authored by Cédric BRINER's avatar Cédric BRINER
Browse files

extract-log-mfa: better handling

parent 579266b9
......@@ -2035,7 +2035,11 @@ function extract_log_mfa_jsessionid
#zgrep -iA1 User-Name "${logpath}" | grep -v -- -- | grep -v User-Name
zgrep -PiA1 "^User-Name: ${username}" "${logpath}" \
| grep -Pv -- '^--$|^User-Name: \S+$'
) | grep -Po "jsessionID:\S+" | sort -u | cut -d ":" -f2
) | grep -Po "jsessionID:\S+" \
| sort -u \
| cut -d ":" -f2 \
| tr "\n" "|" \
| sed 's:|$::'
}
......@@ -2048,14 +2052,19 @@ function extract_log_mfa
fi
for logpath in $(ls -t1 ${IDP_HOME}/logs/idp-process*); do
pb "check log $(basename $logpath) to find user (${username})"
for jsessionid in $(extract_log_mfa_jsessionid "$username" "${logpath}"); do
pb " - found jsesionID: ${jsessionid}"
zgrep -P -w "${username}|${jsessionid}" "${logpath}" \
| grep -P --color "${username}|Access-\S+|${jsessionid}"
done
pb " - shall we check a previous log file [y/N] : "
ljsessionid="$(extract_log_mfa_jsessionid ${username} ${logpath})"
if [[ -z ${ljsessionid} ]]; then
pb " - No jsessionID found for user (${username})"
else
pb " - jsessionID (${ljsessionid}) found for user (${username})"
regex="${ljsessionid}|${username}"
pb " - use cmd: grep -P '${regex}' ${logpath}"
zgrep -P -w "${regex}" ${logpath} \
| grep -P --color "${regex}|Access-\S+"
fi
pb " - shall we check a previous log file [Y/n] : "
read do_read_previous_log_file
if [[ $do_read_previous_log_file != "y" ]]; then
if [[ $do_read_previous_log_file == "n" ]]; then
exit 0
fi
done
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment