exists() — rsyslog 8.2412.0 documentation

# exists()

## Purpose

exists($!path!varname)

This function checks if the specified variable exists, in other words: contains a value. A variable that once was set and later on unset does also not exist.

The function accepts a single argument, which needs to be a variable. It returns 0 if the variable does not exist and 1 otherwise. The function can be combined with any other expression to form more complex expressions.

New in version 8.2010.10.

## Example

    if exists(!$path!varname) then ...
    if not exists($.local!var) then ...
    if exists($!triggervar) and $msg contains "something" then ...

See also

Help with configuring/using `Rsyslog`:

- Mailing list - best route for general questions

- GitHub: rsyslog source project - detailed questions, reporting issues that are believed to be bugs with `Rsyslog`

See also

Contributing to `Rsyslog`:

- Source project: rsyslog project README.

- Documentation: rsyslog-doc project README

Copyright 2008-2023 Rainer Gerhards (Großrinderfeld), and Others.