通过Google脚本访问管理员审核日志 [英] Accessing the Administrator Audit Log via Google Script

查看:85
本文介绍了通过Google脚本访问管理员审核日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管热烈的搜索,我不相信我已经拿出了我所需要的结果。在Google Apps for Business管理员控制台中,在报告下有审核日志。这个审计日志几乎显示了我需要的一切;但是,我需要的是文件的实际名称,而不是报告中提供的fileID。



最终的终极目标是通过Google脚本生成自动日报表每天为少数用户提供相同的数据。有什么方法可以访问这些数据吗?我一直在倾吐API,也许我错过了一些东西,但我不觉得我已经找到了我需要的东西。



任何想法和帮助将不胜感激。感谢您的时间和注意事项。 使用

.com / google-apps / admin-audit /rel =nofollow noreferrer> Google Apps管理审核API 。这使用OAuth,这有时会有点棘手。您可以在此视频中看到设置过程。我们做到了。除了示例所示外,您还可以在 API控制台中启用Apps Reporting and Audit API,而不是使用YouTube API 。



我建立了一个这个简单的例子,你可以看到在操作中。以域管理员身份登录后访问此URL。它会自动在您的云端硬盘中创建一个电子表格,并导出最新的审计日志。这是一个部署为以用户身份运行的Web应用程序。





我已经在此处 Github 。您应该替换正确的OAuth2客户端ID /密码。代码很粗糙,所以你需要清理它。我有选择地记录几列,但如果你看看API文档,还有其他的东西可以登录。

一旦设置了OAuth令牌,只要您刷新令牌,就可以在触发器上运行该令牌。



希望这会有所帮助。

Despite fervent searches, I don't believe I have come up with quite the results I am needing. Within the Google Apps for Business Administrator console, under "Reports" there is the "Audit Log." This audit log nearly displays everything I need; however, I am needing the actual name of the file instead of the fileID provided in the report.

The ultimate endgame is to generate, via Google Script, an automated daily report that gives this same data to a few users daily. Is there any means by which I may access this data? I have been pouring over the APIs, and perhaps I've missed something, but I don't feel that I've found what I needed.

Any thoughts and help would be greatly appreciated. Thank you for your time and considerations.

解决方案

This is possible using the Google Apps Admin Audit API. This uses OAuth and that is a bit tricky to setup sometimes. You can see the set up process in this video that we did. Except as the example shows, instead of the YouTube APIs enable the Apps Reporting and Audit APIs in the API Console.

I built out a simple example of this that you can see in operation. Access this URL after having been logged in as the domain admin. It will automatically create a Spreadsheet in your Drive with the latest Audit logs exported. This is a web app that is deployed as "Run as user".

I've open sourced this Github here. You should substitute in the right OAuth2 Client ID/Secret. The code is pretty rough so you'll want to clean it up. I am selectively logging a few columns but if you look at the API docs, there are other things you can log as well.

Once the OAuth token is set up you can have this run on a trigger as well as long as you refresh the token.

Hope this helps.

这篇关于通过Google脚本访问管理员审核日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆