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

Telegraf strings processor trim to length #5877

Closed
raffraffraff opened this issue May 17, 2019 · 1 comment · Fixed by #6189
Closed

Telegraf strings processor trim to length #5877

raffraffraff opened this issue May 17, 2019 · 1 comment · Fixed by #6189
Labels
feature request Requests for new plugin and for new features to existing plugins
Milestone

Comments

@raffraffraff
Copy link

Feature Request

It should be possible to use the strings processor to trim values based on length. In some cases (eg: docker container IDs) a 12 character value is perfectly acceptable, but there is no way to do this with trim_right, as there isn't a specific delimiter that can be used

Proposal:

Add an additional optional flag to the configuration that performs simple substring using numerical position (eg: container_id[:12])

Current behavior:

You can only truncate on spaces or delimiters

Desired behavior:

You can truncate on position

Use case:

With docker in particular, there are image IDs and container IDs which are perfectly acceptable at a 12 character length (the default chosen by the docker cli). Across a large fleet this reduction could have a performance increase.

@danielnelson
Copy link
Contributor

Seems useful, maybe we call it left (name inspired by postgres function):

[[processors.strings]]
  [[processors.strings.left]]
    field = "container_id"
    width = 12

@danielnelson danielnelson added the feature request Requests for new plugin and for new features to existing plugins label May 17, 2019
@danielnelson danielnelson added this to the 1.12.0 milestone Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants