Le point de terminaison History<\/A> de l'API REST est un excellent outil pour explorer les informations sur les événements se produisant dans votre organisation. Bien que vous puissiez facilement télécharger un CSV complet des événements en tant qu'administrateur dans ArcGIS Online, l'API REST offre la possibilité de personnaliser les données retournées et de poser des questions plus spécifiques. Pour un exemple d'utilisation du CSV history, consultez ce blog : https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-\/administration\/exploring-the-organization-activity-log-csv<\/SPAN><\/A> <\/SPAN><\/P> <\/SPAN><\/P>Pour ce blog, je vais explorer les requêtes nécessaires pour exporter des informations sur les événements de connexion pour une organisation spécifique. Pour utiliser des paramètres spécifiques avec cette API actuellement, le format csv doit être utilisé en raison de : BUG-000120745. Cela est prévu d'être corrigé dans une future version, mais le CSV est un excellent format pour de grandes quantités d'informations.<\/P> <\/SPAN><\/P>Scénario :<\/STRONG> Andy l'administrateur veut comprendre quels utilisateurs se sont connectés à ArcGIS Online et depuis quelles applications en février 2019. Il soupçonne qu'Oreo J. Sampson, son employé, ne connaît pas son mot de passe mais a peur de demander sa réinitialisation car il le demande tous les jours. Andy va vérifier les informations de connexion de son organisation pour confirmer cela.<\/SPAN><\/P><\/P>Étapes du détective :<\/STRONG><\/SPAN><\/P> <\/SPAN>Formuler la requête :<\/LI><\/OL>Url :<\/STRONG> https:\/\/sampson23.maps.arcgis.com\/sharing\/rest\/portals\/self\/history<\/A>?<\/P>Paramètres :<\/STRONG><\/P>all=true<\/EM> 999999999999999999retourne les événements pour tous les membres de l'organisation<\/P>start=0<\/EM> 9démarre au premier enregistrement<\/P>num=10000<\/EM> 9nombre maximal d'événements retournés (requiert le format csv)<\/P>f=csv<\/EM> 9retourne le résultat au format csv<\/P>sortOrder=asc<\/EM> 9informations triées par ordre croissant<\/P>token = 26quot;6hVsODGfBpk5X_hGc0MOrnxmddIk4bL4hP8FyOAxM0QxL3VEw86iTdB26quot;<\/EM> 9jeton administrateur requis<\/P>fromDate =2019-02-01<\/EM> 9début de la plage de dates<\/P>toDate=2019-02-28<\/EM> 9fin de la plage de dates<\/P>actions= failedlogin<\/EM> 9événements à retourner<\/P> <\/P>Url exemple construite :<\/STRONG><\/P>https:\/\/sampson23.maps.arcgis.com\/sharing\/rest\/portals\/self\/history?all=true&start=0&actions=failedLogin&sortOrder=asc&toDate=2019-02-28&fromDate=2019-02-01&num=10000&f=csv&token=<token<\/A>><\/P>Soumettre la requête et visualiser le CSV résultant (Échec de connexion<\/A>)<\/LI><\OL>Notez que certains champs ont été modifiés pour anonymiser les données publiées)<\EM></\P><\P style="padding-left: 30px;"><\/P><\OL start="3"> <\SPAN>Après inspection du CSV, vous pouvez remarquer qu'Oreo a échoué à se connecter le 1er février et n'a plus échoué par la suite.<\LI></\OL><\P style="margin-left: .25in;"> <\P><\OL start="4"> <\SPAN>Pour savoir si Oreo s'est déjà connecté avec succès, ajoutez simplement login au paramètre actions pour recevoir les événements failed login et login :<\LI></\OL><\P style="padding-left: 30px;">https:\/https://sampson23.maps.arcgis.com/sharing/rest/portals/self/history?all=true&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;&ampampampampampampampampampampampampampampampampampampampampampampampampampampampamptoken=<token</A>><\p >Lecture du fichier CSV résultant,< /a > je peux voir qu'Oreo s'est finalement connecté à ArcGIS Online en utilisant ArcGIS Online et ArcGIS Desktop.< /p > < /p >Avec ces résultats, Andy peut comprendre qui s'est connecté à l'organisation, avec succès ou non, et depuis quelle application.< /p >< /p >Une note sur les actions de connexion : < /strong >< /p >Une action de connexion est enregistrée chaque fois qu'un appel réussi est effectué vers oath2 ou generate token login.< /span > Si vous cliquez sur « Rester connecté » sur le formulaire de connexion ArcGIS, alors le jeton sera valide pendant deux semaines ; le point d'entrée /signin ne sera pas appelé et aucun enregistrement ne sera ajouté au journal < /span >history.< /span >< /span >< /p >< /p >*Note. Disponible uniquement avec ArcGIS Online.< /span >< /p >< /p >https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2019/03/16/generate-a-token?sr=search&searchId=7be441a7-7a1c-4790-9f71-75c0231db009&searchIndex=1
Paramètres :<\/STRONG><\/P>all=true<\/EM> 999999999999999999retourne les événements pour tous les membres de l'organisation<\/P>start=0<\/EM> 9démarre au premier enregistrement<\/P>num=10000<\/EM> 9nombre maximal d'événements retournés (requiert le format csv)<\/P>f=csv<\/EM> 9retourne le résultat au format csv<\/P>sortOrder=asc<\/EM> 9informations triées par ordre croissant<\/P>token = 26quot;6hVsODGfBpk5X_hGc0MOrnxmddIk4bL4hP8FyOAxM0QxL3VEw86iTdB26quot;<\/EM> 9jeton administrateur requis<\/P>fromDate =2019-02-01<\/EM> 9début de la plage de dates<\/P>toDate=2019-02-28<\/EM> 9fin de la plage de dates<\/P>actions= failedlogin<\/EM> 9événements à retourner<\/P> <\/P>Url exemple construite :<\/STRONG><\/P>
Notez que certains champs ont été modifiés pour anonymiser les données publiées)<\EM></\P><\P style="padding-left: 30px;"><\/P><\OL start="3"> <\SPAN>Après inspection du CSV, vous pouvez remarquer qu'Oreo a échoué à se connecter le 1er février et n'a plus échoué par la suite.<\LI></\OL><\P style="margin-left: .25in;"> <\P><\OL start="4"> <\SPAN>Pour savoir si Oreo s'est déjà connecté avec succès, ajoutez simplement login au paramètre actions pour recevoir les événements failed login et login :<\LI></\OL><\P style="padding-left: 30px;">
Lecture du fichier
< /p >
Avec ces résultats, Andy peut comprendre qui s'est connecté à l'organisation, avec succès ou non, et depuis quelle application.< /p >
Une note sur les actions de connexion : < /strong >< /p >Une action de connexion est enregistrée chaque fois qu'un appel réussi est effectué vers oath2 ou generate token login.< /span > Si vous cliquez sur « Rester connecté » sur le formulaire de connexion ArcGIS, alors le jeton sera valide pendant deux semaines ; le point d'entrée /signin ne sera pas appelé et aucun enregistrement ne sera ajouté au journal < /span >history.< /span >< /span >< /p >< /p >*Note. Disponible uniquement avec ArcGIS Online.< /span >< /p >< /p >
This is incredibly helpful information, Thanks for the great post!
I am wondering if it is possible to create this same type of log file using the python API and pandas data frame? My management is looking for statistics on user adoption and they want to see the when and how our users are accessing our AGOL site. Ideally, they would love to see stats going back to late 2017 / 2018. From what I can tell the Python API has a history method that could be used; however, I am not able to find a way to filter out unwanted events (i.e. actions=login and a subset of GIS technicians ). Also given the csv limitation (max of 10k events) and the amount of time I need to go back both AGOL Download Activity Log and the Python API history method don’t seem to be great options.
Any suggestions would be greatly appreciated.
kgerrow@esri.com
Thanks for the informative post!
I have a similar question to Matt's above -- we're trying to get a sense of how many active ArcGIS Pro users we have in a given year. Since we used named accounts, I did a query using the REST API with "actions=login" and "clientId=arcgisprodesktop" as part of the parameters. Worked well, but I'm getting hampered by the 10k limitation. Is there any way to download/access more than 10k rows at a time?
Hi,
Matt Martin/USA Martin, I'm looking into your questions with the Python API. Will let you know when I have more information.
Reina Murray, there is a 10k limit to the amount of records that can be retrieved in a single request. I would recommend either using a filter like search only for login actions to try to limit the query, or make multiple requests to the history api on different dates. This way you can break up your requests so they don't exceed the 10K limit.
The limit ensures that data queried through this API is performant, so therefor will need logic to parse through different days if you do want to collect and analyze these actions.
Reina Murray My workaround to the 10k max, though not ideal, was to use postman and make multiple requests to the history api as suggested above. However, in doing so I discovered that the history api seemed to ignore my toDate (end of date range) parameter. This meant I ended up getting duplicate events when I combined all of the csv exports together. I used the “ReqID” field as the unique identifier to remove all duplicates except the first occurrence. This can be easily done in excel using a free add-in called Kutools.
Kelly Gerrow Thank you for looking into this some more for me. I would also like to ask if you know if the history api has a limit to how far it can go back. I tried using the multiple request workflow like you mentioned above using the first and last day of each month (exp. 2018-01-01 to 2018-01-31).
My hope was to start at Jan 1st 2018 and go month by month till I reached the current date (Jan 9th 2020). The weird thing was that it was not until August (2018-08-01 to 2018-08-31) that I got my first login result of Dec 6, 2018.
I know I should have had login events prior to this date as I am able to view older content creation, deletion, and sharing events using the download activity log, located on the AGOL organization overview page. Any additional resources you may know of would be incredibility helpful.
Thank you again!!!
I tried with my ArcGIS Enterprise 10.7.1, but always the csv has not rows. There is something to do at DataStore or setting some options somewhere?
I just read the note: Only available with ArcGIS Online, then I wonder if this functionality will be migrate toward on-premise environment, I means ArcGIS Enterprise ?
Is there a way to view login events on ArcGIS Enterprise?
Hi everyone,
Any update related to login events on ArcGIS Enterprise. I got the same as @FranciscoHernandez2 when I execute the following endpoint:
https://<root>/portal/sharing/rest/portals/self/history?all=true&start=0&actions=failedLogin&sortOrder=asc&toDate=2019-02-28&fromDate=2019-02-01&num=10000&f=csv&token=%3Ctoken
The csv output file (auditLog.csv) have empty rows. Is there any alternative to obtain a tracking report?
Thanks,
S.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.