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

Rewrite rename #3841

Merged
merged 4 commits into from Nov 25, 2021
Merged

Rewrite rename #3841

merged 4 commits into from Nov 25, 2021

Conversation

Kokan
Copy link
Collaborator

@Kokan Kokan commented Nov 16, 2021

This is a native implementation of #3814. The interface has been tweaked a little with using positional options.

rewrite { rename("old_name" "new_name"); };

In the following cases the rename() does not changes the message:

  • If source() equals to destination()
  • If source() entry not present in the message

@Kokan Kokan added the user-visible-feature User visible feature label Nov 16, 2021
@MrAnno
Copy link
Collaborator

MrAnno commented Nov 16, 2021

+1 for the positional version :)

A general confusion already exists when using name-value pairs, due to the value() syntax, which we sometimes call key(), but the template() syntax is there too, which accepts macros.

I'm not sure which version would be more intuitive for our users, but for me, rename("old_name", "new_name"); is the one.

@kira-syslogng
Copy link
Contributor

Build SUCCESS

lib/rewrite/rewrite-rename.c Outdated Show resolved Hide resolved
lib/logmsg/logmsg.c Outdated Show resolved Hide resolved
@kira-syslogng
Copy link
Contributor

Build SUCCESS

@kira-syslogng
Copy link
Contributor

Build SUCCESS

@kira-syslogng
Copy link
Contributor

Build SUCCESS

bazsi
bazsi previously approved these changes Nov 24, 2021
Copies source() value into the destination(), and removes the source()
nv entry.

If source() == destination() this means do nothing.
If the source() points to a not existing nv entry, also does nothing.

```
rewrite {
  rename( source("from") destination("to") );
}
```

Signed-off-by: Kokan <kokaipeter@gmail.com>
Signed-off-by: Kokan <kokaipeter@gmail.com>
Signed-off-by: Kokan <kokaipeter@gmail.com>
Instead of providing source/destination options, simply use the first
string as source and the second string as destination.

```
rewrite {
  rename("old_key" "new_key")
};
```

Signed-off-by: Kokan <kokaipeter@gmail.com>
@Kokan
Copy link
Collaborator Author

Kokan commented Nov 24, 2021

Resolved conflict.

@kira-syslogng
Copy link
Contributor

Build SUCCESS

Copy link
Collaborator

@MrAnno MrAnno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool :)

@bazsi bazsi merged commit 8a467d9 into syslog-ng:master Nov 25, 2021
@Kokan Kokan deleted the rewrite-rename branch November 25, 2021 09:36
gaborznagy pushed a commit to gaborznagy/syslog-ng that referenced this pull request Dec 16, 2021
Signed-off-by: Gabor Nagy <gabor.nagy@oneidentity.com>
bazsi added a commit that referenced this pull request Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user-visible-feature User visible feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants