With an Enterprise license, Dgraph can generate audit logs that let you track and audit all requests (queries and mutations).
We’re overhauling Dgraph’s docs to make them clearer and more approachable. If you notice any issues during this transition or have suggestions, please let us know.
As a database administrator, you count on being able to audit access to your database. With a Dgraph enterprise license, you can enable audit logging so that all requests are tracked and available for use in security audits. When audit logging is enabled, the following information is recorded about the queries and mutations (requests) sent to your database:
Most queries and mutations sent to Dgraph Alpha and Dgraph Zero are logged. Specifically, the following are logged:
The following aren’t logged:
/health
, /state
and /jemalloc
endpointsCheck
and Watch
)StreamMembership
,
UpdateMembership
, Oracle
, Timestamps
, ShouldServe
and Connect
)All audit logs are in JSON format. Dgraph has a “rolling-file” policy for audit logs, where the current log file is used until it reaches a configurable size (default: 100 MB), and then is replaced by another current audit log file. Older audit log files are retained for a configurable number of days (default: 10 days).
For example, by sending this query:
You’ll get the following JSON audit log entry:
You can enable audit logging on a Dgraph Alpha or Dgraph Zero node by using the
--audit
flag to specify semicolon-separated options for audit logging. When
you enable audit logging, a few options are available for you to configure:
compress=true
tells Dgraph to use compression on older audit log filesdays=20
tells Dgraph to retain older audit logs for 20 days, rather than the
default of 10 daysoutput=/path/to/audit/logs
tells Dgraph which path to use for storing audit
logsencrypt-file=/encryption/key/path
tells Dgraph to encrypt older log files
with the specified keysize=200
tells Dgraph to store audit logs in 200 MB files, rather than the
default of 100 MB filesYou can see how to use these options in the example commands below.
The commands in this section show you how to enable and configure audit logging.
In the simplest scenario, you can enable audit logging by simply specifying the directory to store audit logs on a Dgraph Alpha node:
You could extend this command a bit to specify larger log files (200 MB, instead of 100 MB) and retain them for longer (15 days instead of 10 days):
In many cases you want to compress older audit logs to save storage space. You can do this with a command like the following:
You can also enable encryption of audit logs to protect sensitive information that might exist in logged requests. You can do this, along with compression, with a command like the following:
To decrypt encrypted audit logs, you can use the dgraph audit decrypt
command,
as follows:
To learn more about the logging features of Dgraph, see Logging.
With an Enterprise license, Dgraph can generate audit logs that let you track and audit all requests (queries and mutations).
We’re overhauling Dgraph’s docs to make them clearer and more approachable. If you notice any issues during this transition or have suggestions, please let us know.
As a database administrator, you count on being able to audit access to your database. With a Dgraph enterprise license, you can enable audit logging so that all requests are tracked and available for use in security audits. When audit logging is enabled, the following information is recorded about the queries and mutations (requests) sent to your database:
Most queries and mutations sent to Dgraph Alpha and Dgraph Zero are logged. Specifically, the following are logged:
The following aren’t logged:
/health
, /state
and /jemalloc
endpointsCheck
and Watch
)StreamMembership
,
UpdateMembership
, Oracle
, Timestamps
, ShouldServe
and Connect
)All audit logs are in JSON format. Dgraph has a “rolling-file” policy for audit logs, where the current log file is used until it reaches a configurable size (default: 100 MB), and then is replaced by another current audit log file. Older audit log files are retained for a configurable number of days (default: 10 days).
For example, by sending this query:
You’ll get the following JSON audit log entry:
You can enable audit logging on a Dgraph Alpha or Dgraph Zero node by using the
--audit
flag to specify semicolon-separated options for audit logging. When
you enable audit logging, a few options are available for you to configure:
compress=true
tells Dgraph to use compression on older audit log filesdays=20
tells Dgraph to retain older audit logs for 20 days, rather than the
default of 10 daysoutput=/path/to/audit/logs
tells Dgraph which path to use for storing audit
logsencrypt-file=/encryption/key/path
tells Dgraph to encrypt older log files
with the specified keysize=200
tells Dgraph to store audit logs in 200 MB files, rather than the
default of 100 MB filesYou can see how to use these options in the example commands below.
The commands in this section show you how to enable and configure audit logging.
In the simplest scenario, you can enable audit logging by simply specifying the directory to store audit logs on a Dgraph Alpha node:
You could extend this command a bit to specify larger log files (200 MB, instead of 100 MB) and retain them for longer (15 days instead of 10 days):
In many cases you want to compress older audit logs to save storage space. You can do this with a command like the following:
You can also enable encryption of audit logs to protect sensitive information that might exist in logged requests. You can do this, along with compression, with a command like the following:
To decrypt encrypted audit logs, you can use the dgraph audit decrypt
command,
as follows:
To learn more about the logging features of Dgraph, see Logging.