I'm a beginner with oracle and I would like to know how to solve the below issue (I also like to learn so would like it to get a bit of an explanation for the solution).
I've two tables one contains rules and the other one contains the logs. Now I want to be able to check which rule is used for an entry in the log. This way I want to check if all rules are still valid or should be updated.
First table: t_logon_log
username os_user program terminal hostname ip_address logon_time
username1 user1 unknown unknown server1 1.2.3.4 12-09-19
username1 user2 unknown unknown server2 2.3.4.5 19-09-19
username1 user3 unknown unknown server3 3.4.5.6 19-10-19
Second table: t_allowed_connections
rule# username os_user program hostname ip_address apply_rule
60 username1 user2 * * * Yes
8 username1 * * * * Yes
Now I've created a query, which simply groups the log table together so I can manually review it.
select Count(*), USERNAME, OS_USER, PROGRAM, TERMINAL, HOSTNAME, IP_ADDRESS
from t_logon_log
where LOGON_TIME > '01-01-19'
group by USERNAME, OS_USER, PROGRAM, TERMINAL, HOSTNAME, IP_ADDRESS
order by USERNAME;
But I would like to create a query which delivers an output which gives me back for each row from the query above which rule# number is valid for that row.
With this I want to compare the result to the rules and see which ones can be deleted on made more strictly.