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

Problem with field substitution #10

Open
wltb opened this issue Jul 26, 2018 · 1 comment
Open

Problem with field substitution #10

wltb opened this issue Jul 26, 2018 · 1 comment

Comments

@wltb
Copy link

wltb commented Jul 26, 2018

There is something wrong with field substitution, or maybe my understanding of the topic is off. I created a minimal working example. Rule file is:

[Rule]
trigger=sh -c "echo $'MESSAGE >> /tmp/log.txt"

[Filter]
PRIORITY<=3

Journal entries are created with logger:

logger -p 0 'lookup_init:136: lookup(yp): map auto.master: Local domain name not set'
logger -p 0 '()'
logger -p 0 '(y)'
logger -p 0 '555(y)555'
logger -p 0 '666555(y)555666'
logger -p 0 '777666555(y)555666777'
logger -p 0 '888777666555(y)555666777888'

(the first message is what made me investigate this, BTW), and then we get

$ cat /tmp/log.txt
()ESSAGE
(y)SSAGE
555(y)555

The journal entries may help with debugging:

$ journalctl -a --no-pager --since '-2h' -u journal-triggerd.service
journal-triggerd[10023]: Failed to execute trigger 'sh -c "echo $'MESSAGE >> /tmp/log.txt"': Text ended before matching quote was found for ". (The text was “sh -c "echo 'lookup_init:136: lookup(yp): map auto.master: Local domain name not set'”)
journal-triggerd[10023]: 666555(y)555666p/log.txt
journal-triggerd[10023]: 777666555(y)555666777txt
journal-triggerd[10023]: Failed to execute trigger 'sh -c "echo $'MESSAGE >> /tmp/log.txt"': Text ended before matching quote was found for ". (The text was “sh -c "echo '888777666555(y)555666777888'”)

Seems like the substituted text replaces the original one if it's longer than the field name, or something like that.

jjk-jacky added a commit that referenced this issue Oct 1, 2018
@jjk-jacky
Copy link
Owner

jjk-jacky commented Oct 1, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants