Capture environment variables
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud. Availability This functionality is generally available and ready for production usage. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Serverless Security
Generally available
Stack
Generally available
You can configure an Elastic Agent policy to capture up to five environment variables (env vars).
- Env var names must be no more than 63 characters, and env var values must be no more than 1023 characters. Values outside these limits are silently ignored.
- Env var names are case sensitive in Linux.
To set up environment variable capture for an Elastic Agent policy:
- Find Policies in the navigation menu or use the global search field.
- Select an Elastic Agent policy.
- Click Show advanced settings.
- Scroll down or search for
linux.advanced.capture_env_varsormac.advanced.capture_env_vars. - Enter the names of env vars you want to capture, separated by commas. For example:
PATH,USER - Click Save.
Captured environment variables are associated with process events, and appear in each event’s process.env_vars field.
To view environment variables in the Events table:
- Click the Events tab on the Hosts, Network, or Users pages, then click Fields in the Events table.
- Search for the
process.env_varsfield, select it, and click Close. A new column appears containing captured environment variable data.