Skip to main content

Availability

ComponentVersionEditions
Tyk Enterprise Developer PortalAvailable since v1.7.0Enterprise

Prerequisites

  1. License: Contact our team to obtain a license or get a self-managed trial license by completing the registration on our website.
  2. Working Tyk Environment: You need access to a running Tyk instance. For quick setup instructions using Docker, please refer to the Tyk Getting Started Guide.
  3. Admin Access: You need admin permissions to configure audit logging in the Portal.

What We Will Do

In this guide, we will:
  1. Enable audit logs in the Tyk Developer Portal using the file storage option
  2. Configure the log file path and format
  3. View the audit logs from the log file
The Developer Portal uses file-based audit logging. Unlike the Tyk Dashboard, the Portal does not currently support database storage for audit logs or viewing them through the Portal UI.

Instructions

1. Configure Audit Logging

To enable audit logging in the Developer Portal, you need to configure the audit log settings.
Set the following environment variables:
PORTAL_AUDIT_LOG_ENABLE=true
PORTAL_AUDIT_LOG_PATH=/var/log/portal
Ensure the directory specified in PORTAL_AUDIT_LOG_PATH exists and is writable by the Portal process. If using containers, mount a volume to persist logs.
For more information on configuration options, refer to the Portal Configuration Reference.

2. Restart the Developer Portal

After updating the configuration, restart your Developer Portal for the changes to take effect:
# For Docker
docker restart tyk-portal

# For Docker Compose
docker compose restart tyk-portal

# For Kubernetes
kubectl rollout restart deployment tyk-portal -n tyk

3. View Audit Logs

Once audit logging is enabled, admin actions are recorded in the portal.log file located in the directory specified by PORTAL_AUDIT_LOG_PATH.

Access the Log File

# View the audit log file
cat /var/log/portal/portal.log

# Follow the log file in real-time
tail -f /var/log/portal/portal.log

# Search for specific actions
grep "[email protected]" /var/log/portal/portal.log
Portal Audit Logs

For Docker Containers

# Access logs from a running container
docker exec -it tyk-portal cat /var/log/portal/portal.log

For Kubernetes

# Access logs from a running pod
kubectl exec -it deployment/tyk-portal -n tyk -- cat /var/log/portal/portal.log

Troubleshooting

  1. Check if audit logging is enabled: Verify PORTAL_AUDIT_LOG_ENABLE is set to true
  2. Verify directory exists: Ensure the directory specified in PORTAL_AUDIT_LOG_PATH exists
  3. Check permissions: Confirm the Portal process has write permissions to the log directory
  4. Check Portal logs: Review Portal startup logs for any configuration errors
# Check if the directory exists
ls -la /var/log/portal/

# Check Portal container logs
docker logs tyk-portal 2>&1 | grep -i audit