-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Remap: contradicting error messages around merge function #6792
Comments
A user hit this with
|
The same happens with the functions:
Basically all strings functions |
We stumbled into a very similar problem as well. However we are observing a very strange behaviour. This does not work (error is expression can result in runtime error):
Now, let's go back and let's try to capture the runtime error:
We now get a this error assignment is unnecessary error because Now, the really puzzling observation is this (note assignment to a variable, not the
The above DOES work. And furthermore:
The direct assignment to Somehow, the assignment to a temporary variable affects the behaviour of subsequent compile-time checks? |
@spencergilbert I tried to reproduce what you have above with the following config: [sources.in]
type = "stdin"
[transforms.normalize_rke]
type = "remap"
inputs = ["in"]
source = """
# Ensure all events are annotated with the "node" they originated from and the
# Vector agent that processed the log
.node = "$VECTOR_SELF_NODE_NAME"
.agent = "$VECTOR_SELF_POD_NAME"
structured, err = parse_json(.message)
if err != null {
log(err, level: "error")
}
. = merge!(., structured, deep: true)
.message = del(.log)
"""
[transforms.normalize_system]
type = "remap"
inputs = ["in"]
source = """
# Ensure all events are annotated with the "node" they originated from and the
# Vector agent that processed the log
.node = "$VECTOR_SELF_NODE_NAME"
.agent = "$VECTOR_SELF_POD_NAME"
structured, err = parse_syslog(.message)
if err != null {
log(err, level: "error")
}
. = merge!(., structured, deep: true)
del(.hostname)
"""
[sinks.out]
inputs = ["normalize*"]
type = "console"
encoding.codec = "json"
[[tests]]
name = "rke:etcd"
[[tests.inputs]]
insert_at = "normalize_rke"
type = "log"
log_fields.file = "/var/lib/rancher/rke/log/etcd_a22beeac9bed291aa86d435db345f2bb97726a5e14f5e92592e5ebf616260b4d.log"
log_fields.message = '''{"log":"2021-03-16 22:09:03.386126 I | mvcc: store.index: compact 84077398\n","stream":"stderr","time":"2021-03-16T22:09:03.386410422Z"}'''
[[tests.outputs]]
extract_from = "normalize_rke"
[[tests.outputs.conditions]]
type = "remap"
source = '''
!exists(.log) &&
.agent == "vector-agent-test" &&
.message == "2021-03-16 22:09:03.386126 I | mvcc: store.index: compact 84077398\n" &&
.node == "test"
'''
[[tests]]
name = "system:auth"
[[tests.inputs]]
insert_at = "normalize_system"
type = "log"
log_fields.file = "/var/log/auth.log"
log_fields.message = '''Mar 16 23:45:01 test CRON[20842]: pam_unix(cron:session): session opened for user root by (uid=0)'''
[[tests.outputs]]
extract_from = "normalize_system"
[[tests.outputs.conditions]]
type = "remap"
source = '''
.agent == "vector-agent-test" &&
.appname == "CRON" &&
!exists(.hostname) &&
.message == "pam_unix(cron:session): session opened for user root by (uid=0)" &&
.node == "test" &&
.procid == 20842 &&
.timestamp == to_timestamp!("2021-03-17T03:45:01Z")
''' However, I got the error about infallibility with both
If I remove the |
@SyluxDX are you able to provide some complete vector configs that demonstrate what you are seeing? I'm actually having difficulty reproducing this. I also haven't been able to reproduce the example from #6792 (comment) yet either. |
Let me look again and see if I can reproduce my own problem :) it's been a little while since I looked at it EDIT: will try and reproduce with v0.12.2 |
@jszwedko thanks! Happy to help! |
@hhromic that would be great! We'd love the feedback and ideas. If you or your team are interested, we also have office hours every Friday we could use to discuss: https://calendly.com/jszwedko/vector-office-hours |
@jszwedko 🤷 I can't even reproduce it myself anymore, I tested a couple versions of vector to see if it had just been resolved somewhere but no dice. Maybe just gremlins? |
Closing this as I believe the issues here are addressed by #7118 . It will be included in the next release on Tuesday (0.13). |
Vector Version
Vector Configuration File
Debug Output
Expected Behavior
Unit tests are passing locally when run, but when deployed to my cluster the config errors. If I remove the abort instruction the unit tests fail locally. I'm not sure if I'm missing an edgecase or something more obvious but it seemed funky.
Actual Behavior
Updated to not abort:
The text was updated successfully, but these errors were encountered: