Skip to content

Vector gives an error when parse config with log_to_metric transform type #23290

Open
@borisboris232

Description

@borisboris232

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

When using transform with type="log_to_metric" , I get an error:

Failed to load ["config.toml"]
------------------------------
x invalid type: map, expected a sequence



in `transforms.log_metric`

However when I change type to
type=["log_to_metric"]
I get another error:

Failed to load ["config.toml"]
------------------------------
x invalid type: sequence, expected dyn TransformConfig
in `transforms.log_metric`

When I tried to use the 3rd way (look at configuration) I got this:

Failed to load ["config.toml"]
------------------------------
x invalid type: sequence, expected a map








in `transforms.log_metric`

I'm sorry if that's not actually a bug.
Maybe I dont understand something right...

Configuration

############################################
### the 1st one 
[transforms.log_metric]
type = "log_to_metric"
inputs = [ "filter_errors" ]
[transforms.log_metric.metrics]
name = "log_err_total"
type = "counter"
tags = [ "level", "message", "host" ]
field = "message"

##################################################
### the 2nd 
[transforms.log_metric]
type = ["log_to_metric"]
inputs = [ "filter_errors" ]
[transforms.log_metric.metrics]
name = "log_err_total"
type = "counter"
tags = [ "level", "message", "host" ]
field = "message"

#########################################
### the 3rd
[transforms.log_metric]
type = "log_to_metric"
inputs = [ "filter_errors" ]
metrics = [
  { name= "log_err_total", type = "incremental", tags = [ "level", "message", "host"], field = "message" }
]

Version

vector 0.47.0 (x86_64-unknown-linux-gnu 3d5af22 2025-05-20 13:53:41.638057046)

Debug Output

############################ the 1st
$ RUST_BACKTRACE=full vector -vvv -c config.toml | jq
2025-06-30T09:17:55.773663Z DEBUG vector::app: Internal log rate limit configured. internal_log_rate_secs=10
2025-06-30T09:17:55.774301Z  INFO vector::app: Log level is enabled. level="trace"
2025-06-30T09:17:55.774595Z DEBUG vector::app: messaged="Building runtime." worker_threads=4
2025-06-30T09:17:55.775083Z TRACE mio::poll: registering event source with poller: token=Token(1), interests=READABLE
2025-06-30T09:17:55.779145Z  INFO vector::app: Loading configs. paths=["config.toml"]
2025-06-30T09:17:55.782004Z DEBUG vector::config::loading: No secret placeholder found, skipping secret resolution.
2025-06-30T09:17:55.783025Z ERROR vector::cli: Configuration error. error=invalid type: map, expected a sequence



in `transforms.log_metric`

############################# the 2nd
$ RUST_BACKTRACE=full vector -vvv -c config2.toml | jq
2025-06-30T09:19:27.654368Z DEBUG vector::app: Internal log rate limit configured. internal_log_rate_secs=10
2025-06-30T09:19:27.654478Z  INFO vector::app: Log level is enabled. level="trace"
2025-06-30T09:19:27.654551Z DEBUG vector::app: messaged="Building runtime." worker_threads=4
2025-06-30T09:19:27.654619Z TRACE mio::poll: registering event source with poller: token=Token(1), interests=READABLE
2025-06-30T09:19:27.658513Z  INFO vector::app: Loading configs. paths=["config2.toml"]
2025-06-30T09:19:27.661557Z DEBUG vector::config::loading: No secret placeholder found, skipping secret resolution.
2025-06-30T09:19:27.662465Z ERROR vector::cli: Configuration error. error=invalid type: sequence, expected dyn TransformConfig
in `transforms.log_metric`


#################################### the 3rd
$ RUST_BACKTRACE=full vector -vvv -c config3.toml | jq
2025-06-30T09:20:38.414555Z DEBUG vector::app: Internal log rate limit configured. internal_log_rate_secs=10
2025-06-30T09:20:38.414680Z  INFO vector::app: Log level is enabled. level="trace"
2025-06-30T09:20:38.414804Z DEBUG vector::app: messaged="Building runtime." worker_threads=4
2025-06-30T09:20:38.414905Z TRACE mio::poll: registering event source with poller: token=Token(1), interests=READABLE
2025-06-30T09:20:38.415404Z  INFO vector::app: Loading configs. paths=["config3.toml"]
2025-06-30T09:20:38.417504Z DEBUG vector::config::loading: No secret placeholder found, skipping secret resolution.
2025-06-30T09:20:38.420823Z ERROR vector::cli: Configuration error. error=invalid type: sequence, expected a map








in `transforms.log_metric`

Example Data

{
"appname": "application1",
"facility": "local0",
"file": "app1.log",
"group": "group1",
"host": "testhost",
"level": "notice",
"message": "Monitoring status of the device is ok",
"os": "unknown",
"procid": null,
"source_type": "stdin",
"timestamp": "2025-06-19T01:52:30+07:00",
"timestamp_end": "2025-06-30T07:08:29.656539332Z"
}

Additional Context

Tried to use vector in docker (debian version), and also installed in os (used the latest version 0.47). The same result.
Also tried another version vector_0.45.0-1_amd64.
Sorry if it's not a bug. I guess I am not very good at understanding something here

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugA code related bug.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions