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

[MQTT topic parsing] Line Protocol elements should each be optional #10207

Closed
samhld opened this issue Dec 2, 2021 · 0 comments · Fixed by #10208
Closed

[MQTT topic parsing] Line Protocol elements should each be optional #10207

samhld opened this issue Dec 2, 2021 · 0 comments · Fixed by #10208
Assignees
Labels
area/mqtt bug unexpected problem or unintended behavior

Comments

@samhld
Copy link
Contributor

samhld commented Dec 2, 2021

Relevent telegraf.conf

[[inputs.mqtt_consumer]]
    servers = ["tcp://localhost:1883"]
    topics = ["sensors/#"]
    data_format = "value"
    data_type = "string"
    [[inputs.mqtt_consumer.topic_parsing]]
        topic = "sensors/+"
        measurement = "measurement/_/"
        tags = "_/sensor_id"

System info

Telegraf 1.21.0 rc0

Docker

No response

Steps to reproduce

See config above

Consider this case:
topic: sensors/0011
message: 45.0

I want Line Protocol like: sensors,sensor_id=0011 value=45.0

Pub to topic: sensors/0011 with message: 45.0

I would configure: measurement = "measurement/_" and tags = "_/sensor_id" and leave fields alone.

Expected behavior

Payloads may contain the necessary missing information for valid Line Protocol so there would be no need to address it in the topic. Or field information is just not required if the user is okay with a value=<value> type of field.

Actual behavior

The topic parsing configuration currently requires that measurement, tags, and fields params all be set and all underscores (i.e. _/_/_) does not circumvent this. A common use case for topic parsing is going to be to add the parsed information to an existing payload.

Additional info

No response

@samhld samhld added the bug unexpected problem or unintended behavior label Dec 2, 2021
@MyaLongmire MyaLongmire self-assigned this Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mqtt bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants