Answered by:
Audit Logs in SharePoint 2013

Question
-
Hello -
Is there a way to make sure audit logs are automatically set when creating new site collections? Basically trying to avoid manually turning it on every time a site collection is created. Additionally is there a script that we can run to automatically turn on logging for all current site collections?
Thanks!
Monica
Thursday, May 12, 2016 9:06 PM
Answers
-
Hi Monika,
Not directly but you can create script and schedule it to check for new created site collection under your webapp
$site = Get-SPSite http://site_URL
$site.Audit.AuditFlags = [Microsoft.SharePoint.SPAuditMaskType]::Update #or any other mask type
$site.Audit.Update()
https://shipoint.com/2012/10/17/setting-sharepoint-2010-audit-log-settings-using-powershell/
and here are the script to make it automate.
http://blog.falchionconsulting.com/index.php/2007/11/set-audit-settings-for-site-collection/
KRISHANA KUMAR
SharePoint Architect
Please click "Mark As Answer" if this post solves your problem or "Vote As Helpful" if it was useful
- Edited by KRISHANA KUMAR Thursday, May 12, 2016 9:34 PM
- Proposed as answer by Lisa Chen1226Microsoft contingent staff Friday, May 13, 2016 9:04 AM
- Marked as answer by Jerry ZyMicrosoft contingent staff Thursday, May 26, 2016 11:39 AM
Thursday, May 12, 2016 9:30 PM -
No, although you can use PowerShell to set them up. If you create Site Collections via PowerShell, it could be a simple addition to a script. You'll want to take a look at SPSite.Audit.AuditFlags as well as SPSite.AuditLogTrimmingretention.
Trevor Seward
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.
- Marked as answer by Jerry ZyMicrosoft contingent staff Thursday, May 26, 2016 11:39 AM
Thursday, May 12, 2016 9:31 PM -
Hi MoPat05,
Refer to the following article about configuring Audit log Settings for All Sites in SharePoint 2013 using PowerShell:
http://www.sharepointdiary.com/2015/07/enable-audit-logs-in-sharepoint-2013-using-powershell.html
Best Regards,
Lisa Chen
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.- Edited by Lisa Chen1226Microsoft contingent staff Friday, May 13, 2016 9:08 AM
- Marked as answer by Jerry ZyMicrosoft contingent staff Thursday, May 26, 2016 11:39 AM
Friday, May 13, 2016 9:06 AM
All replies
-
Hi Monika,
Not directly but you can create script and schedule it to check for new created site collection under your webapp
$site = Get-SPSite http://site_URL
$site.Audit.AuditFlags = [Microsoft.SharePoint.SPAuditMaskType]::Update #or any other mask type
$site.Audit.Update()
https://shipoint.com/2012/10/17/setting-sharepoint-2010-audit-log-settings-using-powershell/
and here are the script to make it automate.
http://blog.falchionconsulting.com/index.php/2007/11/set-audit-settings-for-site-collection/
KRISHANA KUMAR
SharePoint Architect
Please click "Mark As Answer" if this post solves your problem or "Vote As Helpful" if it was useful
- Edited by KRISHANA KUMAR Thursday, May 12, 2016 9:34 PM
- Proposed as answer by Lisa Chen1226Microsoft contingent staff Friday, May 13, 2016 9:04 AM
- Marked as answer by Jerry ZyMicrosoft contingent staff Thursday, May 26, 2016 11:39 AM
Thursday, May 12, 2016 9:30 PM -
No, although you can use PowerShell to set them up. If you create Site Collections via PowerShell, it could be a simple addition to a script. You'll want to take a look at SPSite.Audit.AuditFlags as well as SPSite.AuditLogTrimmingretention.
Trevor Seward
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.
- Marked as answer by Jerry ZyMicrosoft contingent staff Thursday, May 26, 2016 11:39 AM
Thursday, May 12, 2016 9:31 PM -
Hi MoPat05,
Refer to the following article about configuring Audit log Settings for All Sites in SharePoint 2013 using PowerShell:
http://www.sharepointdiary.com/2015/07/enable-audit-logs-in-sharepoint-2013-using-powershell.html
Best Regards,
Lisa Chen
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.- Edited by Lisa Chen1226Microsoft contingent staff Friday, May 13, 2016 9:08 AM
- Marked as answer by Jerry ZyMicrosoft contingent staff Thursday, May 26, 2016 11:39 AM
Friday, May 13, 2016 9:06 AM