forked from syslog-ng/syslog-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
Http url templates plus urlencoded templates #120
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
Closed
bazsi
wants to merge
28
commits into
alltilla:http-templated-url
from
bazsi:http-url-templates-plus-urlencoded-templates
Closed
Http url templates plus urlencoded templates #120
bazsi
wants to merge
28
commits into
alltilla:http-templated-url
from
bazsi:http-url-templates-plus-urlencoded-templates
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This prepares easier transition to templated urls. Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Currently the http-worker is only using the literal functionality. Implementing support there will be done in the following commits. Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
If we are batching, the first message of the batch will be used for the template evaluation. Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
I believe the only use case of using worker-partition-key() in the http() driver is when we are configuring a templated url(). In that scenario we should be flushing on worker key change. Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
In order to recurse into our grammar we can't use global variables to track objects we are parsing into. This solution uses the $0 value for rule actions to pass arguments to that specific rule, this time the LogTemplate instance we need to parse into. That way the LogTemplate instance would be separate even if we are recursing into the same parts of the grammar. A similar solution could potentially be established to all similar cases, using global variables in a recursive grammar is not right. Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
To be able to use separate grammar rules for template references and inline templates. Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
…dule Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
A top_level LogTemplate is one which is instantiated directly from the configuration or by a driver. For embedded LogTemplate instances (e.g. within function invocations), this is FALSE. The idea is that some operations (e.g. escaping) are only performed at the top level. Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
With this patch it becomes possible to enable escaping from both the LogTemplate side (e.g. when template-escape(yes) is present in a template statement) and the LogTemplateOptions side (e.g. with the destination driver specific template-escape()) option. Previously only LogWriter supplied this setting and it only worked in case of an inline template. With this change, this works with all drivers that support the `template_option` grammar rule. Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Earlier, template functions were performing escaping as a part of their
own expansion of macros/values. This means that a template-escape(yes)
template, with embedded template functions, the template functions received
its arguments in an escaped form.
For example this template:
template t_escaped {
template("$(echo $(length ${value}))");
template-escape(yes)
};
where $value contains characters that need to be escaped (e.g. quotes
or control characters), $(length) received the escaped format.
This patch changes this behaviour slightly by:
1) embedded template expressions always get strings in an unescaped form
2) the end result of functions are escaped at the top-level.
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
This patch moves escaping to one layer higher, thereby ensuring a consistent escaping implmentation and simplifying the lower layers. Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
With this change the call-site of log_template_format_*() family of functions can supply a custom escaping mechanism. Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
65e3713 to
c668be7
Compare
Owner
|
Thanks, rebased my PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This branch adds the new #4666 plus a couple of patches to your http stuff so that we properly escape the URLs as needed.
Instead of merging this, you might want to rebase against syslog-ng#4666 and add the last two patches only.