-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add support for Geo IP #2120
Comments
@cyriltovena @slim-bean This is a good feature to support. However, this requires us to package the geolite2 or any other similar database file along side Promtail. Also, we should figure out if the WDYT? |
nginx with the module ngx_http_geoip_module can writes geodata tag to the access log nginx log WITH GEODATA TAG -> Promtail -> Loki -> Grafana P.S. I’m just surprised that the Grafana lab didn’t realize such a simple thing even at the time of the announcement of Loki |
Hi @WarraxUA and folks. I've been using an preview branch of the upcoming metrics and field extraction feature. This allowed me to build the below dashboard, with metrics on high cardinality fields. For the Worldmap I've added the GEOIP module to Nginx, and added the country name to the log output. With the following expression I was able to sum by countryname as input for the worldpanel. (syntax pending to change, and it's a bit double escaped |
Looking good! |
That looks better than good to me, is the preview branch you speak of available publically, alternatively, is there a time frame in which it will be available? I am currently in the prototyping stage of my project, so running unreleased isn't a concern. |
Here is the repo https://github.com/cyriltovena/demo/blob/master/logql/docker-compose.yaml#L8 There’s a small readme but also I gave a talk at GrafanaCon about this https://grafana.com/go/grafanaconline/loki-future/ see at the end, when you hear my weird and funny french accent you found it 😂 For ETA this is hard we’re still trying to make sure the syntax is easy to use and learn as we will live with this forever. So soon TM. |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Are here any updates? It's a important feature |
Being able to enrich data either upon collection in promtail (via a plugin?) or when that data lands in Loki, is really very important. |
I would love seeing this too. |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Any news? |
Here's just a thought. Wouldn't it be more preferable to enrich data after the logs are collected, then one would not have to add extra overhead on the web server. To be honest though I really don't know how much overhead the geoip would add, but if you have many sites it could impact. |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
A comment to keep this issue open. |
example dashboard from wardbekker1 with Geo_IP |
The dashboards shared in this thread are very nice, but they don't address the issue highlighted by the OP, which is; there is currently no way to enrich data either within Promtail or at the point of ingestion into Loki. GeoIP is a good example of this, but it would apply to any enrichment of collected log data using external lookups. (this is possible using fluend as a client, but then you're stepping outside the stack) Hope this helps clarify what is being requested here, as things seem to have got muddied over time. |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
A comment to keep this issue open. |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
I'm interested in how you did this @pmorange. |
Thanks for the detailed explanation. This is enriching before putting the data into the blockstore. I think I will have to do something similar with logstash, but I would be interested in moving the enrichment to Loki so it's only done for the loglines we display and not all the loglines. Of course I'm not sure that's possible. ;-) |
This functionality would be very useful, if implemented in Loki it's independent from the agent. |
Hi! This issue has been automatically marked as stale because it has not had any We use a stalebot among other tools to help manage the state of issues in this project. Stalebots are also emotionless and cruel and can close issues which are still very relevant. If this issue is important to you, please add a comment to keep it open. More importantly, please add a thumbs-up to the original issue entry. We regularly sort for closed issues which have a We may also:
We are doing our best to respond, organize, and prioritize all issues but it can be a challenging task, |
I've moved from promtail to vector and have this working pretty well. Vector is highly configurable. |
Hi! This issue has been automatically marked as stale because it has not had any We use a stalebot among other tools to help manage the state of issues in this project. Stalebots are also emotionless and cruel and can close issues which are still very relevant. If this issue is important to you, please add a comment to keep it open. More importantly, please add a thumbs-up to the original issue entry. We regularly sort for closed issues which have a We may also:
We are doing our best to respond, organize, and prioritize all issues but it can be a challenging task, |
This issue is still relevant |
ping |
Would you like to try this?Another Loki client |
ping |
hi, I got a temporary solution and it works well https://github.com/Nihiue/loki-enhance-middleware |
Damn, I'd just use Vector instead of promtail at that point @Nihiue but good stuff. |
any news? |
Interesting. Can someone share the vector config / how to? Or the other methods |
@adityacs new update on this? |
I would also like an update |
It would be great if there'd be some kind of adapter to get the geoip data into grafana dashboards. I collect access logs from multiple nginx instances running in docker containers (using the docker loki logging driver) and don't want to bloat every docker container by including the geoip module. |
Ping - Keeping this alive. |
Step by step guide to have GeoIP information in nginx logs available to loki: 1.- create an account on MaxMind for geolite2: 2.- once logged in, create a license key for geolite2. 3.- in your nginx ingress configuration add (for an ingress nginx deployed using helm):
4.- Once in loki, you can make a LogQL query like this:
5.- (optional) You can also make the parsing in promtail, for better performance and versatility. Take into consideration you will need to have your nginx installation properly configured to get clients real ip, that can vary among cloud providers. |
Thanks a lot, because the other issue only says "Add geoip stage in promtail", but I could not find any documentation about this new feature, anywhere. I may have badly looked, that's another possible problem hehehe |
I wrote that because I struggle HARD to get that working, and there is no clear documentation anywhere. |
Got it working today. Used latest docker image for loki and promtail with this version The documentation was good enough since I already was familiar with pipeline stages of promtail. this is my promtail-config.yml for caddy reverse proxy, the data caddy sends are json.. so its cleaner than regex and named groups I guess
And the funny thing is that for two IPs I tried, one was resolved as a city in another country, but contry was mine.. so free maxmind is not exactly shining, but its good enough I guess. Now just to spend hours tinkering on getting that cool world map thing going on... |
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
It would be great if promtail/loki had a GEO IP feature like LogStash. E.g. regex identifies IP addresses in log message and performs GEO IP look-up to add additional fields to store location. This could then be used by the Grafana World Map plugin - though this plugin may also need updating.
Describe alternatives you've considered
ELK. It already has this feature -> LogStash Geo IP filter + Kibana world map.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: