- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
12-05-2017 11:50 AM
In the below code - I"m using the API to query the URL logs. It works great.
What isn't returning though is the src.user field, if it's mapped. How can I get this value? Do I need to do a separate query?
JP
# Build PAN API Connection and get token pan_conn = pan.xapi.PanXapi(api_username=args.pan_username, api_password=args.pan_password, hostname=args.pan_hostname, timeout=5.000, ssl_context=None) url = args.url tld = get_tld(url.replace("\\", ""), fail_silently=True) if tld is None: logger.warning('No TLD Returned, falling back to URL') tld = url elif tld: logger.info('Found TLD') # Set time window to look back if args.lookback == '15m': lookback_window = '15-minutes' elif args.lookback == '1h': lookback_window = 'hour' query = "(url contains '{0}') and (time_generated in last-{1})".format(tld, str(lookback_window)) action = 'log' log_type = 'url' options = { 'log': log_type, 'filter': query, 'print_xml': False, 'print_json': True, 'print_result': True, 'print_python': False, 'print_text': True } logger.info(url) logger.info(query) log = pan_conn.log(log_type=options['log'], filter=options['filter'], nlogs=20, timeout=30) print_status(pan_conn, action) print_response(pan_conn, options)
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!