graphite-project / carbon

Carbon is one of the components of Graphite, and is responsible for receiving metrics over the network and writing them down to disk using a storage backend.
http://graphite.readthedocs.org/
Apache License 2.0
1.5k stars 490 forks source link

Rewriting does not occur #936

Closed guidoffm closed 5 months ago

guidoffm commented 2 years ago

I use the Helm chart:

https://artifacthub.io/packages/helm/kiwigrid/graphite version 0.7.2

I have added these rules to rewrite-rules.conf:

    [pre]
    ^(.+) = somePrefix.someOther.\1
    [post]
    ^(.*) = bar.\1

I cannot see any rewriting. Do I have to activate the rewriting in another file?

deniszh commented 2 years ago

I'm afraid it's some issue in chart itself or config propagation to carbon. I didn't test config above but it looks legit, though.

guidoffm commented 2 years ago

I don't believe it is an issue with the chart because I have noticed that:

When there is a problem in the regex the log shows there is a problem. Maybe I could try to test other container images.

guidoffm commented 2 years ago

The Helm chart is here:

https://github.com/kiwigrid/helm-charts/tree/master/charts/graphite

guidoffm commented 2 years ago

I don't believe it is an issue with the chart because I have noticed that:

When there is a problem in the regex the log shows there is a problem. Maybe I could try to test other container images.

The problem is also there with image tag 1.1.8-8.

guidoffm commented 2 years ago

I found out this problem exists also when I run the pure Docker image:

docker run -d  --name graphite  --restart=always  -p 8080:80  \
-p 2003-2004:2003-2004  -p 2023-2024:2023-2024  \
-p 8125:8125/udp  -p 8126:8126 \
-v "$(pwd)"/rewrite-rules.conf:/opt/graphite/conf/rewrite-rules.conf graphiteapp/graphite-statsd
deniszh commented 2 years ago

Hmm... Then it's need to investigated, will try to dig more.

deniszh commented 2 years ago

Hi @guidoffm Sorry, it took me some time to find what the issue is. Rewrite is not part of carbon-cache, rewrite is part of carbon-aggregator. Aggregator is running in docker container by default, but listening port 2023 instead of 2003. You can switch them, if needed: carbon.conf

[cache]
LINE_RECEIVER_PORT = 2023
...
[aggregator]
LINE_RECEIVER_PORT = 2003
LOG_AGGREGATOR_MISSES = False
Screenshot 2022-05-22 at 13 51 02
deniszh commented 2 years ago

PS: unfortunately, carbon.conf is not configurable by environment variables, you need to mount fixed file or bake it in the image.