Skip to content
Notifications
Clear all

Just built a script to audit our mobile user locations - sharing the method.

1 Posts
1 Users
0 Reactions
75 Views
(@cloud_cost_breaker)
Honorable Member
Joined: 5 months ago
Posts: 591
Topic starter   [#15894]

Having recently completed a deep-dive into our Palo Alto Prisma Access bill, I was struck by the significant cost impact of our mobile user locations. Our "GlobalProtect Mobile Users" package costs are directly tied to the geographic regions we provision. Like many, we started with a broad deployment, but user movement patterns had shifted, leaving us paying for underutilized regions.

To move from guesswork to data-driven optimization, I built an audit script. It parses the GlobalProtect log feed from Panorama (or the NGFW directly) to map unique users to their primary connection locations over a 30-day period. The goal isn't to track every login, but to identify which regions are truly essential for your user base, enabling a potential downsizing of your Prisma Access package.

The core logic extracts user and source location data. Here's a simplified Python snippet using the `pan-os-python` SDK:

```python
from panos.firewall import Firewall
import pandas as pd
from datetime import datetime, timedelta

fw = Firewall("panorama.example.com", "api_user", "api_password")
log_type = "globalprotect"

# Query logs for last 30 days
now = datetime.now()
past = now - timedelta(days=30)
logs = fw.log(log_type, fetch_all=True, start=past, end=now)

user_location_map = {}
for entry in logs:
user = entry.get("user", "")
region = entry.get("source_region", "")
if user and region:
if user not in user_location_map:
user_location_map[user] = {}
user_location_map[user][region] = user_location_map[user].get(region, 0) + 1

# Determine primary region per user
user_primary_region = {}
for user, regions in user_location_map.items():
primary = max(regions, key=regions.get)
user_primary_region[user] = primary

# Aggregate count per region for reporting
region_summary = {}
for region in user_primary_region.values():
region_summary[region] = region_summary.get(region, 0) + 1

df = pd.DataFrame(list(region_summary.items()), columns=["Region", "Unique User Count"])
print(df.sort_values(by="Unique User Count", ascending=False))
```

This output provides a clear, quantifiable basis for a cost conversation. If you discover 90% of your mobile users connect solely from two regions, but you're licensed for five, you have a direct path to substantial cost optimization. The next step is correlating this data with your actual Prisma Access SKUs and engaging with your account team.

Important considerations:
* This analyzes connection patterns, not real-time policy. Ensure any region removal aligns with security posture and compliance needs.
* Include a sufficient sample period (30 days) to account for travel or temporary relocation.
* The script focuses on mobile users; don't forget to apply similar analysis to your Remote Networks and Service Connections for a full picture.


Less spend, more headroom.


   
Quote