feat: add path tag to file input
Use Case
my use case would be as follows, I am using the hostname of the container in the folder path, I would like to retrieve it as host in my indexing. I think it would be interesting to have a path_tag configuration to extract this! or file_tag_fullname to set to true or false to get all filepath name with file.
Expected behavior
[[inputs.file]]
files = ["/logs/*/*.log"]
file_tag = "system"
path_tag = "host"
influx_timestamp_precision = "1s"
[[processors.regex]]
[[processors.regex.tags]]
key = "system"
pattern = "^([a-z0-9]+)(-.+)"
replacement = "${1}"
[[processors.regex.tags]]
key = "host"
pattern = "^/logs/(\\w+)/$"
replacement = "${1}"
get tags system and host
Actual behavior
only can get file.
Additional info
No response
Happy to see a PR for this that would add a path_tag config option that adds the path, versus the file name, which is what file_tag does today. This would of course default to false and should probably have a warning as well about possible carnality in the config option comments.
Hmm, I think it makes more sense to have an extra option to enable the full file name in the existing tag.
Current:
metric,file=telegraf.log msg="foobar"
New:
metric,file=/var/log/telegraf.log msg="foobar"