Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded template functions don't work #59

Closed
ihrwein opened this issue Jan 9, 2014 · 2 comments
Closed

Embedded template functions don't work #59

ihrwein opened this issue Jan 9, 2014 · 2 comments
Assignees
Labels

Comments

@ihrwein
Copy link
Contributor

ihrwein commented Jan 9, 2014

I tried to use the following template function, but syslog-ng didn't accept it:

template("$(format-json  --scope rfc5424  --exclude FILE_NAME --pair .SDATA=$(format-json --scope sdata))\n")

The error message was:

Error parsing affile, Error compiling template, error=$ in /home/balabit/install/syslog-ng-3.5/etc/syslog-ng.conf at line 50, column 18:

        template("$(format-json  --scope rfc5424  --exclude FILE_NAME .SDATA=$(format-json --scope sdata))\n")
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

syslog-ng documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
mailing list: https://lists.balabit.hu/mailman/listinfo/syslog-ng

I used syslog-ng OSE 3.5.

@algernon
Copy link
Contributor

algernon commented Jan 9, 2014

I think this may be a $(format-json) bug. Because this works:

template("$(+ 1 $(+ 1 1))\n")

@bazsi
Copy link
Collaborator

bazsi commented Jan 9, 2014

I have a preliminary patch that fixes this issue on the 3.6/f/stricter-type-hint-parsing branch I have just pushed.

There's also a workaround. This should work:

$(format-json --scope rfc5424 --exclude FILE_NAME .SDATA=string($(format-json --scope sdata)))

@algernon the problem is that type-hinting uses the same syntax as template functions and $ was taken as a typehint, which in fact was a template function call operator. Let's discuss this IRL how this should be solved.

@ghost ghost assigned algernon Jan 27, 2014
szemere pushed a commit to szemere/syslog-ng that referenced this issue Jul 2, 2020
macOS: update the macOS build guide
bazsi added a commit to bazsi/syslog-ng that referenced this issue May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants