Skip to content

Commit

Permalink
remove stdlib function features (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuchsnj committed May 22, 2023
1 parent 3ac0149 commit b308189
Show file tree
Hide file tree
Showing 9 changed files with 327 additions and 1,218 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## unreleased
- added the `timezone` argument to the `format_timestamp` vrl function.
- removed feature flags for each individual VRL function.

## `0.4.0` (2023-05-11)
- consolidated all crates into the root `vrl` crate. The external API stayed the same, with the exception of macros, which are now all exported at the root of the `vrl` crate.
Expand Down
324 changes: 7 additions & 317 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,327 +46,17 @@ lua = ["dep:mlua"]
# Internal testing utilities (used for benches)
test = []

# stdlib without any functions
stdlib-core = ["compiler"]

# All stdlib functions
stdlib = [
"stdlib-core",
"stdlib_abs",
"stdlib_append",
"stdlib_array",
"stdlib_assert",
"stdlib_assert_eq",
"stdlib_boolean",
"stdlib_ceil",
"stdlib_chunks",
"stdlib_compact",
"stdlib_contains",
"stdlib_decode_base16",
"stdlib_decode_base64",
"stdlib_decode_gzip",
"stdlib_decode_percent",
"stdlib_decode_mime_q",
"stdlib_decode_zlib",
"stdlib_decode_zstd",
"stdlib_decrypt",
"stdlib_del",
"stdlib_downcase",
"stdlib_encode_base16",
"stdlib_encode_base64",
"stdlib_encode_gzip",
"stdlib_encode_json",
"stdlib_encode_key_value",
"stdlib_encode_logfmt",
"stdlib_encode_percent",
"stdlib_encode_zlib",
"stdlib_encode_zstd",
"stdlib_encrypt",
"stdlib_ends_with",
"stdlib_exists",
"stdlib_filter",
"stdlib_find",
"stdlib_flatten",
"stdlib_float",
"stdlib_floor",
"stdlib_for_each",
"stdlib_format_int",
"stdlib_format_number",
"stdlib_format_timestamp",
"stdlib_get",
"stdlib_get_env_var",
"stdlib_get_hostname",
"stdlib_hmac",
"stdlib_includes",
"stdlib_integer",
"stdlib_ip_aton",
"stdlib_ip_cidr_contains",
"stdlib_ip_subnet",
"stdlib_ip_ntoa",
"stdlib_ip_ntop",
"stdlib_ip_pton",
"stdlib_ip_to_ipv6",
"stdlib_ipv6_to_ipv4",
"stdlib_is_array",
"stdlib_is_boolean",
"stdlib_is_empty",
"stdlib_is_float",
"stdlib_is_integer",
"stdlib_is_ipv4",
"stdlib_is_ipv6",
"stdlib_is_json",
"stdlib_is_null",
"stdlib_is_nullish",
"stdlib_is_object",
"stdlib_is_regex",
"stdlib_is_string",
"stdlib_is_timestamp",
"stdlib_join",
"stdlib_keys",
"stdlib_length",
"stdlib_log",
"stdlib_map_keys",
"stdlib_map_values",
"stdlib_match",
"stdlib_match_any",
"stdlib_match_array",
"stdlib_match_datadog_query",
"stdlib_md5",
"stdlib_merge",
"stdlib_mod",
"stdlib_now",
"stdlib_object",
"stdlib_parse_aws_alb_log",
"stdlib_parse_aws_cloudwatch_log_subscription_message",
"stdlib_parse_aws_vpc_flow_log",
"stdlib_parse_apache_log",
"stdlib_parse_cef",
"stdlib_parse_common_log",
"stdlib_parse_csv",
"stdlib_parse_duration",
"stdlib_parse_glog",
"stdlib_parse_grok",
"stdlib_parse_groks",
"stdlib_parse_int",
"stdlib_parse_json",
"stdlib_parse_key_value",
"stdlib_parse_klog",
"stdlib_parse_linux_authorization",
"stdlib_parse_logfmt",
"stdlib_parse_nginx_log",
"stdlib_parse_query_string",
"stdlib_parse_regex",
"stdlib_parse_regex_all",
"stdlib_parse_ruby_hash",
"stdlib_parse_syslog",
"stdlib_parse_timestamp",
"stdlib_parse_tokens",
"stdlib_parse_url",
"stdlib_parse_user_agent",
"stdlib_parse_xml",
"stdlib_push",
"stdlib_random_bool",
"stdlib_random_bytes",
"stdlib_random_float",
"stdlib_random_int",
"stdlib_redact",
"stdlib_remove",
"stdlib_replace",
"stdlib_reverse_dns",
"stdlib_round",
"stdlib_seahash",
"stdlib_set",
"stdlib_sha1",
"stdlib_sha2",
"stdlib_sha3",
"stdlib_slice",
"stdlib_split",
"stdlib_starts_with",
"stdlib_string",
"stdlib_strip_ansi_escape_codes",
"stdlib_strip_whitespace",
"stdlib_strlen",
"stdlib_tally",
"stdlib_tally_value",
"stdlib_tag_types_externally",
"stdlib_timestamp",
"stdlib_to_bool",
"stdlib_to_float",
"stdlib_to_int",
"stdlib_to_string",
"stdlib_to_regex",
"stdlib_to_syslog_facility",
"stdlib_to_syslog_level",
"stdlib_to_syslog_severity",
"stdlib_to_timestamp",
"stdlib_to_unix_timestamp",
"stdlib_truncate",
"stdlib_type_def",
"stdlib_unique",
"stdlib_unnest",
"stdlib_upcase",
"stdlib_uuid_v4",
"stdlib_values"
"compiler", "core", "datadog", "dep:aes", "dep:ctr", "dep:cbc", "dep:cfb-mode", "dep:ofb", "dep:base16", "dep:nom", "dep:strip-ansi-escapes",
"dep:utf8-width", "dep:hex", "dep:seahash", "dep:syslog_loose", "dep:hostname", "dep:zstd", "dep:quoted_printable", "dep:once_cell",
"dep:base64", "dep:uuid", "dep:percent-encoding", "dep:uaparser", "dep:rust_decimal", "dep:indexmap", "dep:flate2", "dep:charset",
"dep:data-encoding", "dep:hmac", "dep:sha-1", "dep:cidr-utils", "dep:sha-2", "dep:md-5", "dep:url", "dep:woothee", "dep:csv",
"dep:roxmltree", "dep:rand", "dep:dns-lookup", "dep:sha-3", "dep:grok"
]

stdlib_abs = ["stdlib-core"]
stdlib_append = ["stdlib-core"]
stdlib_array = ["stdlib-core"]
stdlib_assert = ["stdlib-core"]
stdlib_assert_eq = ["stdlib-core"]
stdlib_boolean = ["stdlib-core"]
stdlib_ceil = ["stdlib-core"]
stdlib_chunks = ["stdlib-core"]
stdlib_compact = ["stdlib-core"]
stdlib_contains = ["stdlib-core"]
stdlib_cryptography = ["stdlib-core", "dep:aes", "dep:ctr", "dep:cbc", "dep:cfb-mode", "dep:ofb"]
stdlib_decode_base16 = ["stdlib-core", "dep:base16", "dep:nom"]
stdlib_decode_base64 = ["stdlib-core", "dep:base64"]
stdlib_decode_gzip = ["stdlib-core", "dep:flate2"]
stdlib_decode_percent = ["stdlib-core", "dep:percent-encoding"]
stdlib_decode_mime_q = ["stdlib-core", "dep:data-encoding","dep:charset","dep:quoted_printable", "dep:nom"]
stdlib_decode_zlib = ["stdlib-core", "dep:flate2"]
stdlib_decode_zstd = ["stdlib-core", "dep:zstd", "dep:nom"]
stdlib_decrypt = ["stdlib-core", "stdlib_cryptography", "stdlib_random_bytes", "stdlib_encrypt"]
stdlib_del = ["stdlib-core"]
stdlib_downcase = ["stdlib-core"]
stdlib_encode_base16 = ["stdlib-core", "dep:base16"]
stdlib_encode_base64 = ["stdlib-core", "dep:base64"]
stdlib_encode_gzip = ["stdlib-core", "dep:flate2", "dep:nom"]
stdlib_encode_json = ["stdlib-core", "dep:serde_json", "dep:chrono", "dep:regex"]
stdlib_encode_key_value = ["stdlib-core", "core"]
stdlib_encode_logfmt = ["stdlib-core", "stdlib_encode_key_value"]
stdlib_encode_percent = ["stdlib-core", "dep:percent-encoding"]
stdlib_encode_zlib = ["stdlib-core", "dep:flate2", "dep:nom"]
stdlib_encode_zstd = ["stdlib-core", "dep:zstd", "dep:nom"]
stdlib_encrypt = ["stdlib-core", "stdlib_cryptography"]
stdlib_ends_with = ["stdlib-core"]
stdlib_exists = ["stdlib-core"]
stdlib_filter = ["stdlib-core"]
stdlib_find = ["stdlib-core", "dep:regex"]
stdlib_find_table_row = ["stdlib-core"]
stdlib_flatten = ["stdlib-core"]
stdlib_float = ["stdlib-core"]
stdlib_floor = ["stdlib-core"]
stdlib_for_each = ["stdlib-core"]
stdlib_format_int = ["stdlib-core"]
stdlib_format_number = ["stdlib-core", "dep:rust_decimal"]
stdlib_format_timestamp = ["stdlib-core", "dep:chrono"]
stdlib_get = ["stdlib-core"]
stdlib_get_env_var = ["stdlib-core"]
stdlib_get_hostname = ["stdlib-core", "dep:hostname"]
stdlib_hmac = ["stdlib-core", "dep:hmac", "dep:sha-1", "dep:sha-2", "dep:hex", "dep:base64"]
stdlib_includes = ["stdlib-core"]
stdlib_integer = ["stdlib-core"]
stdlib_ip_aton = ["stdlib-core"]
stdlib_ip_cidr_contains = ["stdlib-core", "dep:cidr-utils"]
stdlib_ip_ntoa = ["stdlib-core"]
stdlib_ip_ntop = ["stdlib-core"]
stdlib_ip_pton = ["stdlib-core", "dep:bytes"]
stdlib_ip_subnet = ["stdlib-core", "dep:once_cell", "dep:regex"]
stdlib_ip_to_ipv6 = ["stdlib-core"]
stdlib_ipv6_to_ipv4 = ["stdlib-core"]
stdlib_is_array = ["stdlib-core"]
stdlib_is_boolean = ["stdlib-core"]
stdlib_is_empty = ["stdlib-core"]
stdlib_is_float = ["stdlib-core"]
stdlib_is_integer = ["stdlib-core"]
stdlib_is_ipv4 = ["stdlib-core"]
stdlib_is_ipv6 = ["stdlib-core"]
stdlib_is_json = ["stdlib-core", "dep:serde", "dep:serde_json"]
stdlib_is_null = ["stdlib-core"]
stdlib_is_nullish = ["stdlib-core"]
stdlib_is_object = ["stdlib-core"]
stdlib_is_regex = ["stdlib-core", "dep:regex"]
stdlib_is_string = ["stdlib-core"]
stdlib_is_timestamp = ["stdlib-core", "dep:chrono"]
stdlib_join = ["stdlib-core"]
stdlib_keys = ["stdlib-core"]
stdlib_length = ["stdlib-core"]
stdlib_log = ["stdlib-core", "dep:tracing"]
stdlib_map_keys = ["stdlib-core"]
stdlib_map_values = ["stdlib-core"]
stdlib_match = ["stdlib-core", "dep:regex"]
stdlib_match_any = ["stdlib-core", "dep:regex"]
stdlib_match_array = ["stdlib-core", "dep:regex"]
stdlib_match_datadog_query = ["stdlib-core", "datadog_search", "datadog_filter", "dep:once_cell", "dep:regex"]
stdlib_md5 = ["stdlib-core", "dep:md-5", "dep:hex"]
stdlib_merge = ["stdlib-core"]
stdlib_mod = ["stdlib-core"]
stdlib_now = ["stdlib-core", "dep:chrono"]
stdlib_object = ["stdlib-core"]
stdlib_parse_apache_log = ["stdlib-core", "dep:chrono", "dep:once_cell", "dep:regex"]
stdlib_parse_aws_alb_log = ["stdlib-core", "dep:nom"]
stdlib_parse_aws_cloudwatch_log_subscription_message = ["stdlib-core", "dep:serde_json", "dep:chrono"]
stdlib_parse_aws_vpc_flow_log = ["stdlib-core"]
stdlib_parse_common_log = ["stdlib-core", "dep:chrono", "dep:once_cell", "dep:regex"]
stdlib_parse_cef = ["stdlib-core", "stdlib_parse_key_value"]
stdlib_parse_csv = ["stdlib-core", "dep:csv"]
stdlib_parse_duration = ["stdlib-core", "dep:rust_decimal", "dep:once_cell", "dep:regex"]
stdlib_parse_glog = ["stdlib-core", "dep:chrono", "dep:once_cell", "dep:regex"]
stdlib_parse_grok = ["stdlib-core", "dep:grok"]
stdlib_parse_groks = ["stdlib-core", "dep:grok", "datadog_grok"]
stdlib_parse_int = ["stdlib-core"]
stdlib_parse_json = ["stdlib-core", "dep:serde_json"]
stdlib_parse_key_value = ["stdlib-core", "dep:nom"]
stdlib_parse_klog = ["stdlib-core", "dep:chrono", "dep:once_cell", "dep:regex"]
stdlib_parse_linux_authorization = ["stdlib-core", "stdlib_parse_syslog", "dep:chrono"]
stdlib_parse_logfmt = ["stdlib-core", "stdlib_parse_key_value"]
stdlib_parse_nginx_log = ["stdlib-core", "dep:chrono", "dep:regex", "dep:once_cell"]
stdlib_parse_query_string = ["stdlib-core", "dep:url"]
stdlib_parse_regex = ["stdlib-core", "dep:regex"]
stdlib_parse_regex_all = ["stdlib-core", "dep:regex"]
stdlib_parse_ruby_hash = ["stdlib-core", "dep:nom"]
stdlib_parse_syslog = ["stdlib-core", "dep:syslog_loose", "dep:chrono"]
stdlib_parse_timestamp = ["stdlib-core", "dep:chrono"]
stdlib_parse_tokens = ["stdlib-core", "core"]
stdlib_parse_url = ["stdlib-core", "dep:url"]
stdlib_parse_user_agent = ["stdlib-core", "dep:woothee","dep:uaparser","dep:once_cell"]
stdlib_parse_xml = ["stdlib-core", "dep:roxmltree", "dep:once_cell", "dep:regex", "dep:rust_decimal"]
stdlib_push = ["stdlib-core"]
stdlib_random_bool = ["stdlib-core", "dep:rand"]
stdlib_random_bytes = ["stdlib-core", "dep:rand"]
stdlib_random_float = ["stdlib-core", "dep:rand"]
stdlib_random_int = ["stdlib-core", "dep:rand"]
stdlib_redact = ["stdlib-core", "dep:once_cell", "dep:regex"]
stdlib_remove = ["stdlib-core"]
stdlib_replace = ["stdlib-core", "dep:regex"]
stdlib_reverse_dns = ["stdlib-core", "dep:dns-lookup"]
stdlib_round = ["stdlib-core"]
stdlib_seahash = ["stdlib-core", "dep:seahash"]
stdlib_set = ["stdlib-core"]
stdlib_sha1 = ["stdlib-core", "dep:sha-1", "dep:hex"]
stdlib_sha2 = ["stdlib-core", "dep:sha-2", "dep:hex"]
stdlib_sha3 = ["stdlib-core", "dep:sha-3", "dep:hex"]
stdlib_slice = ["stdlib-core"]
stdlib_split = ["stdlib-core", "dep:regex"]
stdlib_starts_with = ["stdlib-core", "dep:utf8-width"]
stdlib_string = ["stdlib-core"]
stdlib_strip_ansi_escape_codes = ["stdlib-core", "dep:bytes", "dep:strip-ansi-escapes"]
stdlib_strip_whitespace = ["stdlib-core"]
stdlib_strlen = ["stdlib-core"]
stdlib_tag_types_externally = ["stdlib-core", "dep:chrono", "dep:regex"]
stdlib_tally = ["stdlib-core"]
stdlib_tally_value = ["stdlib-core"]
stdlib_timestamp = ["stdlib-core"]
stdlib_to_bool = ["stdlib-core"]
stdlib_to_float = ["stdlib-core", "dep:chrono"]
stdlib_to_int = ["stdlib-core", "dep:chrono"]
stdlib_to_regex = ["stdlib-core", "dep:tracing", "dep:regex"]
stdlib_to_string = ["stdlib-core", "dep:chrono"]
stdlib_to_syslog_facility = ["stdlib-core"]
stdlib_to_syslog_level = ["stdlib-core"]
stdlib_to_syslog_severity = ["stdlib-core"]
stdlib_to_timestamp = ["stdlib-core", "dep:chrono"]
stdlib_to_unix_timestamp = ["stdlib-core", "dep:chrono"]
stdlib_type_def = ["stdlib-core"]
stdlib_truncate = ["stdlib-core"]
stdlib_unique = ["stdlib-core", "dep:indexmap"]
stdlib_unnest = ["stdlib-core"]
stdlib_upcase = ["stdlib-core"]
stdlib_uuid_v4 = ["stdlib-core", "dep:bytes", "dep:uuid"]
stdlib_values = ["stdlib-core"]

[dependencies]
cfg-if = "1.0.0"

# Optional dependencies
anymap = { version = "1.0.0-beta.2", optional = true }
Expand Down
3 changes: 1 addition & 2 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ data-encoding,https://github.com/ia0/data-encoding,MIT,Julien Cretin <git@ia0.eu
debug-helper,https://github.com/magiclen/debug-helper,MIT,Magic Len <len@magiclen.org>
derive_more,https://github.com/JelteF/derive_more,MIT,Jelte Fennema <github-tech@jeltef.nl>
digest,https://github.com/RustCrypto/traits,MIT OR Apache-2.0,RustCrypto Developers
dirs,https://github.com/soc/dirs-rs,MIT OR Apache-2.0,Simon Ochsenreither <simon@ochsenreither.de>
dirs-next,https://github.com/xdg-rs/dirs,MIT OR Apache-2.0,The @xdg-rs members
dirs-sys,https://github.com/dirs-dev/dirs-sys-rs,MIT OR Apache-2.0,Simon Ochsenreither <simon@ochsenreither.de>
dirs-sys-next,https://github.com/xdg-rs/dirs/tree/master/dirs-sys,MIT OR Apache-2.0,The @xdg-rs members
dns-lookup,https://github.com/keeperofdakeys/dns-lookup,MIT OR Apache-2.0,Josh Driver <keeperofdakeys@gmail.com>
doc-comment,https://github.com/GuillaumeGomez/doc-comment,MIT,Guillaume Gomez <guillaume1.gomez@gmail.com>
Expand All @@ -81,6 +79,7 @@ hermit-abi,https://github.com/hermitcore/libhermit-rs,MIT OR Apache-2.0,Stefan L
hermit-abi,https://github.com/hermitcore/rusty-hermit,MIT OR Apache-2.0,Stefan Lankes
hex,https://github.com/KokaKiwi/rust-hex,MIT OR Apache-2.0,KokaKiwi <kokakiwi@kokakiwi.net>
hmac,https://github.com/RustCrypto/MACs,MIT OR Apache-2.0,RustCrypto Developers
home,https://github.com/rust-lang/cargo,MIT OR Apache-2.0,Brian Anderson <andersrb@gmail.com>
hostname,https://github.com/svartalf/hostname,MIT,"fengcen <fengcen.love@gmail.com>, svartalf <self@svartalf.info>"
iana-time-zone,https://github.com/strawlab/iana-time-zone,MIT OR Apache-2.0,"Andrew Straw <strawman@astraw.com>, René Kijewski <rene.kijewski@fu-berlin.de>, Ryan Lopopolo <rjl@hyperbo.la>"
iana-time-zone-haiku,https://github.com/strawlab/iana-time-zone,MIT OR Apache-2.0,René Kijewski <crates.io@k6i.de>
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ VRL is broken up into multiple components, which can be enabled as needed.
| diagnostic | yes | Logic related to errors and displaying info about them. |
| path | yes | Contains the parser, datatypes, and functions related to VRL paths. |
| stdlib | yes | All of the VRL functions from the standard library. |
| stdlib_* | yes | Each stdlib function has it's own feature to enable/disable them. |
| core | yes | Various data structures and utility methods (these may be renamed / moved in the future). |
| datadog_filter | yes | Implements the Datadog log search query filter syntax. |
| datadog_grok | yes | Implements the Datadog grok parser. (used with `parse_grok` and `parse_groks` in the stdlib). |
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub mod parser;
#[cfg(feature = "core")]
pub mod core;

#[cfg(feature = "stdlib-core")]
#[cfg(feature = "stdlib")]
pub mod stdlib;

#[cfg(feature = "cli")]
Expand Down
Loading

0 comments on commit b308189

Please sign in to comment.