icon/x Created with Sketch.

Splunk Cookie Policy

We use our own and third-party cookies to provide you with a great online experience. We also use these cookies to improve our products and services, support our marketing campaigns, and advertise to you on our website and other websites. Some cookies may continue to collect information after you have left our website. Learn more (including how to update your settings) here.
Accept Cookie Policy

We are working on something new...

A Fresh New Splunkbase
We are designing a New Splunkbase to improve search and discoverability of apps. Check out our new and improved features like Categories and Collections. New Splunkbase is currently in preview mode, as it is under active development. We welcome you to navigate New Splunkbase and give us feedback.
Log4Shell Vulnerability: Information and guidance for you. Get resources.

Accept License Agreements

This app is provided by a third party and your right to use the app is in accordance with the license provided by that third-party licensor. Splunk is not responsible for any third-party apps and does not provide any warranty or support. If you have any questions, complaints or claims with respect to this app, please contact the licensor directly.

Thank You

Downloading Gmail Audit
SHA256 checksum (gmail-audit_1010.tgz) 8f50fd95ef147618330faaf007d54dde746a9524f93e1389700c7579d233b31c SHA256 checksum (gmail-audit_109.tgz) fe52453e3fd961f822acaf6685634a93ee643f72a806b63f4e8aec7234bb452b SHA256 checksum (gmail-audit_108.tgz) 60893fb6e31e4cc78b301bb1924990b5c411b8ecff800444bf1bdf3619e04aa6 SHA256 checksum (gmail-audit_107.tgz) 364335ce77e88ce3e76914cd5bbf3e7f734804d6d0b61b5b709ef658d1e3dc5a SHA256 checksum (gmail-audit_105.tgz) fb08271a0a974e6cdf2b86ed0b0d248dc44a6989fc3a26e405c88220e6a2c031 SHA256 checksum (gmail-audit_104.tgz) ec7e944773b036df9b58d7c51a206010b6d6a5140efa3fa03a41ec90f2321653 SHA256 checksum (gmail-audit_103.tgz) 8d03dfcaa606d55370af771ca60e45011834a78d147c2a798d8c6c48a507df63 SHA256 checksum (gmail-audit_102.tgz) 683c6c52264a73eb4928c10a485ba77bbad5ea62f2aa888d1cb953687764e2de SHA256 checksum (gmail-audit_101.tgz) 442b1ec45800b2a50c12bc077c8fcb30ad74eaa232c6c4fd34bb8fb636046096
To install your download
For instructions specific to your download, click the Details tab after closing this window.

Flag As Inappropriate


Gmail Audit

This app provides three main functions for organisations using Google GSuite and Gmail:
- Enable auditing on Gmail inboxes of users in the G Suite Directory and configure email audit events to go the specified audit recipient inbox
- Retrieve audited emails (headers only) from the audit recipient inbox
- Retrieve the G Suite Directory listing of users and their attributes


The Gmail Audit TA for Splunk allows a Splunk Enterprise administrator to interface with Google G Suite and Gmail to achieve the following for one or more G Suite domains:

  • Gather a list of users and their attributes from the G Suite Directory
  • Enable Gmail auditing for users in the G Suite Directory and configure audit events to be sent to an audit recipient inbox
  • Gather audit events from the inbox of the audit recipient user

WARNING: Due to the way the Gmail audit process works, i.e. audit events are sent to an Gmail inbox of a user in the same domain, there are hard-limits to the number of emails that can be received by that user. If you have a large number of users in your domain(s) and they are all sending audit events to this inbox each time a user sends or receives an email, the audit user inbox gets swamped and is not able to receive email until the suspension is lifted. Gmail receive limits are detailed here: https://support.google.com/a/answer/1366776?hl=en

Scripts and binaries

This App provides the following scripts:

gmail_authorize.py This Python custom endpoint allows the authorization of the App to G Suite For Splunk from the web UI.
input_module_gsuite_directory_user_list.py Gather a listing of users from the G Suite Directory and load them into Splunk.
input_module_gmail_enforce_audit.py Enable Gmail audit for any users in the directory that do not currently have auditing enabled.
input_module_gmail_disable_audit.py Disable Gmail audit for any users in the directory that have auditing enabled. This is not part of the add-on UI yet. If you need to use this, overwrite the input_module_gmail_enforce_audit.py audit with this script and let it run to disable auditing.
input_module_gmail_retrieve_audit_data.py Retrieve audit events from the inbox of the recipient user, load into Splunk and mark messages as read.
Utilities.py Allows utility interactions with Splunk Endpoints


  • Download the add-on from Splunkbase
  • Install the add-on onto your Splunk instance. This could be a single-instance or a data collection instance (HF). Install via the UI or CLI as you would any other Splunk app.
  • Restart Splunk


Key concepts for Gmail Audit TA for Splunk

  • You must have enabled the G Suite APIs at https://console.developers.google.com
  • You must have configured a credential for use with this App at https://console.developers.google.com.
  • You must AUTHORIZE this app to make requests into G Suite APIs.
  • It is HIGHLY recommended to setup a separate Splunk-specific Super Admin user within Google G Suite for use with this add-on

G Suite: Enable APIs

For a detailed guide with screenshots about what to do here, please visit my blog about this add-on: Gmail Audit TA for Splunk


The app provides three input templates. Each requires an HTTP Event Collector token to which to send events. These do not need to be unique and can be the same token for all three inputs.

HTTP Event Collector

  • Configure a new HTTP Event Collector token and use this when configuring the inputs. Follow this guide if you are unsure how to setup a HEC token.

G Suite Directory User List

  • Enter a name for the input (include the domain in the name if you are using multiple domains for clarity)
  • Set the interval (e.g. once per day [86400 seconds])
  • Choose the destination index
  • Enter the domain for which you have configured and authorised credentials
  • Enter an HTTP Event Collector token to receive the events
  • Enter the hostname to which to send events (in most cases this should be localhost, where the HEC token is configured)

Gmail Enforce Audit

  • Enter a name for the input (include the domain in the name if you are using multiple domains for clarity)
  • Set the interval (e.g. once per day [86400 seconds])
  • Choose the destination index
  • Enter the Audit Recipient address (this should be the email of the Super Admin account used to authorize the credentials)
  • Enter an HTTP Event Collector token to receive the events
  • Enter the hostname to which to send events (in most cases this should be localhost, where the HEC token is configured)

There seems to be a hard 1000 request per day limit on the Gmail Audit API. I tried to get this increased, but did not have any luck.
The request to check if auditing is enabled counts as 1 request, as does the call to set auditing if it is not enabled, which means you can check and enable auditing on only 500 users per day.
The first thing this script does is read the G Suite Directory and get a list of all users in the domain. If there are more than 500 users returned, the script will randomly delete half the users in the list (think Thanos snapping his fingers). This ensures that the script does not run into API limits and over time, all users will evenutally have auditing enabled.
If anyone knows how to get that limit increased, please let me know and I will gladly remove that bit of code.

Gmail Retrieve Audit Data

  • Enter a name for the input (include the name of the domain if you are using multiple domains for clarity e.g. example.com-Enable-audit, example.com-Retrieve-audit )
  • Set the interval (e.g. once every 5 minutes [300 seconds])
  • Choose the destination index
  • Enter the domain for which you have configured and authorised credentials
  • Enter an HTTP Event Collector token to receive the events
  • Enter the hostname to which to send events (in most cases this should be localhost, where the HEC token is configured)
  • Enter a batch size of audit messages to process. 20 is a good default as it does not seem to run into API limits.



If you see any errors like this, it is likely that there is another add-on installed in your environment that has a httplib2 module included in its directory structure.

2019-07-25 03:56:09,304 log_level=ERROR pid=89865 tid=MainThread file="gmail_authorize.py" function="handle_GET" line_number="112" version="TA-gmail-audit.1.0.5" {'errors': [{'msg': 'setproxy() takes at most 7 arguments (8 given)', 'exception_type': 'TypeError', 'line': 104, 'exception_arguments': 'setproxy() takes at most 7 arguments (8 given)', 'filename': 'gmail_authorize.py'}], 'log_level': 'ERROR'}

Any submodules included in any apps installed/enabled are visible to Splunk Python, so if you say "include httplib2" in your module, you have no guarantee that the module included in your app folder is going to be used. I think it simply uses the first one it finds.

If you run into this error, modify the /opt/splunk/etc/apps/TA-gmail-audit/bin/gmail_authorize.py script and uncomment the following lines:

# import imp
# modfile, pathname, description = imp.find_module('httplib2', ['/opt/splunk/etc/apps/TA-gmail-audit/bin/'])
# httplib2 = imp.load_module('httplib2', modfile, pathname, description)`

Obviosuly adjust the path if your Splunk and add-on are installed in a location other than '/opt/splunk/etc/apps/TA-gmail-audit/bin/'

This ensures the httlib2 module included in the Gmail Audit TA folder is used and not any other httplib2 modules found in other apps/add-ons.


Development of this add-on was commissioned by Qantas Airways. Qantas kindly agreed to allow this to add-on to be released to Splunkbase to support the Splunk community.

The credentials authorisation and storage mechanism in this add-on is duplicated from the G Suite for Splunk add-on written by Kyle Smith. Being able to re-use this code saved me a lot of time in not having to develop similar functionality. Thanks to Kyle Smith for writing the G Suite for Splunk add-on.

Release Notes

Version 1.0.10
Feb. 18, 2021

Fixing connectivity issues when going through outbound proxy

Version 1.0.9
July 24, 2020

Including attachment hashing (md5, sha1, sha256). Thanks to Shannon Davis for contributing this code.

Version 1.0.8
July 22, 2020

Removing calls to global Google batch API endpoints that are being deprecated. Using concurrent calls instead. Also added the option to include message body in audit events.

Version 1.0.7
July 16, 2020

Splunk 8 compatibility

Version 1.0.5
July 7, 2020

Bug fixes with some of the scripts. Final release prior to updating to Splunk 8 compatibility.

Version 1.0.4
Sept. 9, 2019

Performance improvement marking audit messages as read after processing. Using the batchModify Gmail API endpoint instead of marking messages as read individually.

Version 1.0.3
Aug. 9, 2019

Minor bug fixes. Disabling file_cache in Google API client connections to prevent file_cache unavailable when using oauth2client >= 4.0.0 errors.

Version 1.0.2
July 29, 2019

Fixing issues with proxy configuration and other minor bug fixes.

Version 1.0.1
June 24, 2019

Initial release

Subscribe Share

Are you a developer?

As a Splunkbase app developer, you will have access to all Splunk development resources and receive a 10GB license to build an app that will help solve use cases for customers all over the world. Splunkbase has 1000+ apps from Splunk, our partners and our community. Find an app for most any data source and user need, or simply create your own with help from our developer portal.

Follow Us:
Splunk, Splunk>,Turn Data Into Doing, Data-to-Everything, and D2E are trademarks or registered trademarks of Splunk Inc. in the United States and other countries. All other brand names,product names,or trademarks belong to their respective owners.