-
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
feat(config): Global Default Log Schemas #1769
feat(config): Global Default Log Schemas #1769
Conversation
The config syntax looks good! But shouldn't the resulting payload in your ouput have both the |
Ok! That clarifies it for me! I wasn't really sure if only the fields the source had configs for would be affected, or all would. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have left a few questions inline.
AFAICT the kafka
sink also appears to use these keys. Should it also be modified to use the new config?
Thanks for this early review @bruceg :) |
Signed-off-by: Ana Hobden <operator@hoverbear.org>
de54b42
to
1944719
Compare
Signed-off-by: Ana Hobden <operator@hoverbear.org>
Signed-off-by: Ana Hobden <operator@hoverbear.org>
Signed-off-by: Ana Hobden <operator@hoverbear.org>
Signed-off-by: Ana Hobden <operator@hoverbear.org>
Signed-off-by: Ana Hobden <operator@hoverbear.org>
Signed-off-by: Ana Hobden <operator@hoverbear.org>
Signed-off-by: Ana Hobden <operator@hoverbear.org>
Signed-off-by: Ana Hobden <operator@hoverbear.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but need to initialize the globals before running unit tests as well.
Signed-off-by: Ana Hobden <operator@hoverbear.org>
Signed-off-by: Ana Hobden <operator@hoverbear.org>
Signed-off-by: Ana Hobden <operator@hoverbear.org>
@Jeffail I did it the easy way. :) |
// TODO: Help Rust project support before_each | ||
// Support uninitialized schemas in tests to help our contributors. | ||
// Don't do it in release because that is scary. | ||
#[cfg(debug_assertions)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not 100% sure on this.
@@ -332,6 +335,35 @@ impl Config { | |||
self.global.dns_servers.sort(); | |||
self.global.dns_servers.dedup(); | |||
|
|||
// If the user has multiple config files, we must *merge* log schemas until we meet a | |||
// conflict, then we are allowed to error. | |||
let default_schema = event::LogSchema::default(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: prob could just do if with.global.log_schema = LogSchema::default()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use it later though :o
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks fantastic, turned out much better than I thought it would :)
Signed-off-by: Ana Hobden <operator@hoverbear.org>
@@ -143,6 +143,7 @@ evmap = { version = "7", features = ["bytes"] } | |||
logfmt = "0.0.2" | |||
notify = "4.0.14" | |||
once_cell = "1.3" | |||
getset = "0.1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LucioFranco Take a look again? |
Signed-off-by: Ana Hobden <operator@hoverbear.org>
Signed-off-by: Ana Hobden <operator@hoverbear.org>
src/sources/syslog.rs
Outdated
@@ -434,6 +437,7 @@ mod test { | |||
} | |||
|
|||
#[test] | |||
#[ignore] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these ignored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed why!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just have one question about those ignored tests otherwise LGTM
Signed-off-by: Ana Hobden <operator@hoverbear.org>
Signed-off-by: Ana Hobden <operator@hoverbear.org>
Nice work on this! I just wanted to couple doc changes with it. I'll follow up with a doc change PR. |
* Global log schemas Signed-off-by: Ana Hobden <operator@hoverbear.org> * Tests working and some lints cleaned. Signed-off-by: Ana Hobden <operator@hoverbear.org> * Fix unix tests Signed-off-by: Ana Hobden <operator@hoverbear.org> * Fixup of remaining unix tests Signed-off-by: Ana Hobden <operator@hoverbear.org> * Use correct naming. Signed-off-by: Ana Hobden <operator@hoverbear.org> * Add better documentation for handling conflicting log_schemas. Signed-off-by: Ana Hobden <operator@hoverbear.org> * fmt Signed-off-by: Ana Hobden <operator@hoverbear.org> * Fixup schema lookup in logdna Signed-off-by: Ana Hobden <operator@hoverbear.org> * Fix benches Signed-off-by: Ana Hobden <operator@hoverbear.org> * Fmt and fix lints Signed-off-by: Ana Hobden <operator@hoverbear.org> * Fix some tests that are dead on Windows. Signed-off-by: Ana Hobden <operator@hoverbear.org> * Docker nits Signed-off-by: Ana Hobden <operator@hoverbear.org> * Fix naming Signed-off-by: Ana Hobden <operator@hoverbear.org> * Fix a test Signed-off-by: Ana Hobden <operator@hoverbear.org> * Missed one! Signed-off-by: Ana Hobden <operator@hoverbear.org> * Unignore tests Signed-off-by: Ana Hobden <operator@hoverbear.org> * Reduce visiblility! Signed-off-by: Ana Hobden <operator@hoverbear.org>
This addresses #1446.
It adds a
log_schema
field to theconfig.global
. It goes intoconfig.global
since this already gets passed to theSourceConfig::build
event. It also exists in the$SOURCE_source
function args as this is used in some tests.Example: