Esri / Utility-Data-Management-Support-Tools

A set of tools to work with the utility network and their maps.
Apache License 2.0
23 stars 4 forks source link

Extract Logs from REST does not query logs from federated machines #12

Closed JayaswalVaibhav closed 2 years ago

JayaswalVaibhav commented 2 years ago

We have a typical setup of ArcGIS Enterprise base deployment on one machine and a separate federated Server machine to host UN services. When I open the tool, it only displays the hosting server in the list of machines. It does not show the federated server site in the list of machines. I am logged in as a user with administrator role in Pro. When I leave the option to select machines unchecked, I expected the tool to include all machines in the output logs. However, I only see the hosting server logs in the output mobile geodatabase. Am I missing something? How can I use this tool to extract logs from the federated server which hosts the UN services?

pLeBlanc93 commented 2 years ago

The current code is incorrectly listing portal machines, not server machines. Which is why it just happens to work for only the machine that portal + server (ie the base deployment) is installed on.

Doing a few more tests, will share a fix shortly.

pLeBlanc93 commented 2 years ago

@JayaswalVaibhav this should resolve the machine filtering. UtilityDataManagementSupport.zip

Delete your existing toolbox and use this.

JayaswalVaibhav commented 2 years ago

@pLeBlanc93 Thanks for sharing the updated toolbox so quick.

We are now able to see the federated server in the list of machines, but when we select the federated server and run the tool, it fails with the following error

Start Time: Wednesday, February 23, 2022 3:22:21 PM
udms 0.3
udms.logic.extract_server_logs(
    folder='C:\\Users\\AnandA\\Documents\\ArcGIS\\Projects\\MyProject\\New Folder (4)',
    from_date=datetime.datetime(2022, 2, 18, 2, 53, 36),
    to_date=datetime.datetime(2022, 2, 21, 14, 53, 46),
    log_level='FINE',
    codes=[],
    process_ids=[],
    request_ids=[],
    components=[],
    services=[],
    machines=['unserver.arcutil.net'],
)
Connecting to arcgis
Accessing logger
Creating MGDB
Defining schema
Querying logs...
2022-02-21 14:53:46
Traceback (most recent call last):
  File "<string>", line 31, in <module>
  File "C:\Users\AnandA\Downloads\UtilityDataManagementSupport\UtilityDataManagementSupport.atbx\udms\esri.py", line 135, in wrapper
  File "C:\Users\AnandA\Downloads\UtilityDataManagementSupport\UtilityDataManagementSupport.atbx\udms\logic\__init__.py", line 421, in extract_server_logs
  File "C:\Users\AnandA\Downloads\UtilityDataManagementSupport\UtilityDataManagementSupport.atbx\udms\logic\log.py", line 192, in main
  File "C:\Users\AnandA\Downloads\UtilityDataManagementSupport\UtilityDataManagementSupport.atbx\udms\logic\log.py", line 164, in query_logs
KeyError: 'hasMore'
Failed script (null)...
Failed to execute (ExtractRESTLogs).
Failed at Wednesday, February 23, 2022 3:22:23 PM (Elapsed Time: 1.95 seconds)

The tool runs successfully if we do not select any machine, and we expect logs from all machines will be included, but we see that only the hosting server logs are saved in the output geodatabase.

Appreciate your help in resolving this.

pLeBlanc93 commented 2 years ago

@JayaswalVaibhav Your deployment -- is it two sites with a single machine each or is it one site with two machines?

I've not seen the results from query logs missing the hasMore key. What version of ArcGIS Server are you using?

JayaswalVaibhav commented 2 years ago

@pLeBlanc93 Yes, it is two sites with a single machine each. We are running v10.9.1 of ArcGIS Server.

pLeBlanc93 commented 2 years ago

Perfect! That explains what is happening now. Depending on the machine(s) selected, I need to change which site I query logs from.

I'll stand up a multi site deployment and do some testing. Thanks a bunch!

pLeBlanc93 commented 2 years ago

@JayaswalVaibhav I've placed the March RC here https://github.com/Esri/Utility-Data-Management-Support-Tools/blob/march/UtilityDataManagementSupport.atbx

A new parameter for server sites drives the filter for services and machines now. This will now query the proper logger. image

JayaswalVaibhav commented 2 years ago

@pLeBlanc93 Thank you so much for sharing the RC. It appears to be working fine now. We will do some more testing and get back to you if we run into any issues.

JayaswalVaibhav commented 2 years ago

@pLeBlanc93 Thank you so much. The tool works like a charm.