Mapper (key, value)
1. for each value
2. extract s, m, r, ip, ua, by parsing
value
3. if (s ∈ [200-299]) & (a ∈ [GET,
POST]) & (f_ext ∉ [multimedia file extensions]) & (ip ∉ [::1, 127.1.1.1,
127.0.0.1])
4. extract t, rf by parsing value
5. key’: composite_key (ip, ua, t)
6. value’: combination of t, rq, &
rf
7. EmitIntermediate (key’, value’)
8. end if
9. end for
Reducer_HT2 (key, values)
1: for each value in values
2: Calculate p_c
3: end for
4: if (p_c equals to 1)
5: Generate U_ID, S_ID
6: value’: U_ID, S_ID, c_val
7: emit (key’, value’)
8: else
// When number of pages are more than 1 in user activity record
9: s_t = 1
10: for each value in values
11: extract c_t from value
12: c_val: value
13: if (s_c = 1)
// Create first session of user
14: Generate U_ID, S_ID
15: value’: U_ID, S_ID, c_val
16: emit (key’, value’)
17: p_t = c_t
18: else if (c_t-prev_t <= 𝝈 )
//Add request to existing session
19: emit (key’, c_val)
20: prev_t = c_t
21: else
//Create new Session for same user
22: s_c++
23: Generate S_ID
24: value’: U_ID, S_ID, c_val
25: emit (key’, value’)
26: prev_t = c_t
27: end if
28: end for
29: end if
|
|
Mapper (key, value)
1: for each value
2: extract s, m, r, ip, ua, by parsing value
3: if(s ∈ [200-299]) & (m ∈ [GET, POST])
& (f_ext ∉ [multimedia file extensions]) & (ua
does not contain keywords [robot aliases])
4: extract t, rf by parsing value
5: key’: composite_key(ip, ua, t)
6: value’: combination of t, rq, & rf
7: EmitIntermediate (key’, value’)
8: end if
9: if (rq contains robots.txt) & (ua does not
contain keywords [robot aliases])
10: extract t, rf by parsing value
11: key’ :composite_key(ip, ua, t)
12: value’: combination of t, rq, & rf
13: EmitIntermediate (key’, value’)
14: end if
15: end for
Reducer_HT2 (key, values)
1. Extract i_t
2. for each value in values
3. Calculate comb_url, l_t & p_c
4. end for
5. if (comb_url contains robots.txt)
6. discard user // robot
7. else if (p_c equals to 1)
8. Generate U_ID, S_ID
9. value’: U_ID, S_ID,c_val
10. emit (key’, value’)
11. else
// When number of pages are more than 1 in user activity record
12. bs = (l_t - i_t + 1 )/p_c
13. end if
14. if (bs < θ)
15. discard user
16. else
17. s_c = 1
18. for each value in values
19. extract c_t from value
20. c_val: value
21. if (s_c== 1)
// Create first session of user
22. Generate U_ID, S_ID
23. value’: U_ID, S_ID, c_val
24. emit (key’, value’)
25. prev_t = c_t
26. else if (c_t - prev_t <= 𝝈 )
//Add request to existing session
27. value’: c_val
28. emit (key’, value’)
29. prev_t = c_t
30. else
//Create new Session for same user
31. s_c++
32. Generate S_ID
33. value’: U_ID, S_ID, c_val
34. emit (key’, value’)
35. prev_t = c_t
36. end if
37. end for
38. end if
|