# getenv()

## Purpose

getenv(str)

Like the OS call, returns the value of the environment variable, if it exists. Returns an empty string if it does not exist.

## Examples

The following example can be used to build a dynamic filter based on some environment variable:

    if $msg contains getenv('TRIGGERVAR') then /path/to/errfile

Support: rsyslog Assistant | GitHub Discussions | GitHub Issues: rsyslog source project

Contributing: Source & docs: rsyslog source project

© 2008–2025 Rainer Gerhards and others. Licensed under the Apache License 2.0.