From 51660ba3edb98a83d4c23613afc359d98f6ca94e Mon Sep 17 00:00:00 2001 From: dancorrigan1 Date: Sat, 23 Nov 2024 10:24:33 -0600 Subject: [PATCH] report includes provider now (#4) * meta update * fix var * match specific lines * one too many pipes and long line * no_logs that expose urls with login info * test * test * test * test * test * test * test * report includes provider --- tasks/dailyconnections.yml | 5 ++++- templates/report.txt.j2 | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tasks/dailyconnections.yml b/tasks/dailyconnections.yml index 82fa521..4094a95 100644 --- a/tasks/dailyconnections.yml +++ b/tasks/dailyconnections.yml @@ -123,13 +123,16 @@ __unique_user_ips: >- {%- set __unique_user_ips = [] -%} {%- set user = 'user' -%} + {%- set provider = 'provider' -%} {%- set ip_list = [] -%} {%- for u in __proxy_users | map(attribute='proxy_username') | unique | sort -%} {%- set __matching_log_lines = __iptv_log | select('search', '/' ~ u) -%} {%- set __ip_list = __matching_log_lines | map('split', ' ') | map('first') | list | unique -%} + {%- set __provider = __proxy_users | selectattr('proxy_username', '==', u) | map(attribute='provider_name') | first -%} {%- set item_dict = { 'user': u, - 'ip_list': __ip_list + 'ip_list': __ip_list, + 'provider': __provider } -%} {%- set _ = __unique_user_ips.append(item_dict) -%} diff --git a/templates/report.txt.j2 b/templates/report.txt.j2 index 9042c47..c18cb11 100644 --- a/templates/report.txt.j2 +++ b/templates/report.txt.j2 @@ -11,7 +11,7 @@ User Usage Summary {% for user in __unique_user_ips %} -------------------------- -checking {{ user.user }} +{{ user.user }} on {{ user.provider }} --------------------------- {% for ip in user.ip_list | unique %}