mtail icon indicating copy to clipboard operation
mtail copied to clipboard

Renaming fields containing dots with graphite exporter

Open vgallissot opened this issue 8 years ago • 0 comments

Dear all,

I'm using latest mtail mtail version v3.0.0-rc4-126-g470f336 git revision 470f336b2e05d54c8c30a2af52eb660772113f7e go version go1.9.2

I want to use mtail to export logs metrics to a graphite host. Some captured fields in my logs are containing dots. Those dots are conflicting with whispers file format.

Do you know what is the proper way to replace dots by underscores in graphite exporter ? I think this is the same idea as the noHyphens function in prometheus exporter

I.E:

counter cache_status by host, upstream_cache_status

/^/ +
/(?P<host>[^|]+)\|/ + # $host
/(?P<upstream_cache_status>[^|]+)\|/ + # $upstream_cache_status
/$/ {
 cache_status[$host][$upstream_cache_status]++
}

Currently exported metrics:

stats_counts.dev.nginx_logs.mtail.cache_status.host.alpha.beta.gamma.com.upstream_cache_status.HIT

Where alpha.beta.gamma.com is the value of the $host field.

Expected result:

stats_counts.dev.nginx_logs.mtail.cache_status.host.alpha_beta_gamma_com.upstream_cache_status.HIT

Thank you very much for your help, Vincent

vgallissot avatar Dec 18 '17 15:12 vgallissot