Skip to content

feat(enrichment tables): add network CIDR field to lookup results#24576

Merged
pront merged 5 commits intovectordotdev:masterfrom
naa0yama:feat/geoip-enrichment-table-add-CIDR
Mar 17, 2026
Merged

feat(enrichment tables): add network CIDR field to lookup results#24576
pront merged 5 commits intovectordotdev:masterfrom
naa0yama:feat/geoip-enrichment-table-add-CIDR

Conversation

@naa0yama
Copy link
Copy Markdown
Contributor

Summary

Add a network field (CIDR notation) to GeoIP enrichment table lookup results.

The MaxMind MMDB lookup API (LookupResult) holds the network (CIDR) information for a given IP address, but the previous implementation only called decode() and discarded it. This PR adds the network field to all supported database types, bringing the output closer to parity with Elasticsearch's GeoIP processor.

Database type Example output
City (GeoIP2-City / GeoLite2-City) 2.125.160.216/29
ISP (GeoIP2-ISP) 208.192.0.0/10
ASN (GeoLite2-ASN) 2600:7000::/24
Connection-Type (GeoIP2-Connection-Type) 201.243.200.0/24
Anonymous-IP (GeoIP2-Anonymous-IP) 101.99.92.179/32

Vector configuration

[enrichment_tables.geoip]
type = "geoip"
path = "/path/to/GeoLite2-City.mmdb"

[sources.demo]
type = "demo_logs"
format = "json"

[transforms.enrich]
type = "remap"
inputs = ["demo"]
source = '''
  .geoip = get_enrichment_table_record("geoip", {"ip": .ip })
  # .geoip.network now contains the CIDR, e.g. "2.125.160.216/29"
'''

[sinks.console]
type = "console"
inputs = ["enrich"]
encoding.codec = "json"

How did you test this PR?

  • cargo test -p vector --lib enrichment_tables::geoip — 12/12 passed
  • cargo test -p vector --lib enrichment_tables::mmdb — 5/5 passed (no impact)
  • cargo clippy — no warnings
  • cargo fmt --check — no formatting diff in changed code

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Notes


A note from the author: This is my first contribution to a Rust project. I am a non-native English speaker and have been writing this PR with the help of translation tools, so I would appreciate it if reviewers could keep comments concise and straightforward. Thank you for your patience and understanding!

@naa0yama naa0yama requested review from a team as code owners January 31, 2026 12:28
@github-actions github-actions Bot added the domain: external docs Anything related to Vector's external, public documentation label Jan 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 31, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@naa0yama
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@naa0yama naa0yama changed the title feat(geoip enrichment table): add network CIDR field to lookup results feat(enrichment tables): add network CIDR field to lookup results Jan 31, 2026
@naa0yama
Copy link
Copy Markdown
Contributor Author

naa0yama commented Mar 4, 2026

Hello,
How's the review of this PR going?

I've completed the necessary information and code fixes, so please check it out.

@naa0yama
Copy link
Copy Markdown
Contributor Author

@domalessi @pront

Hello,
How is the PR progressing? I'm looking forward to it being included in the release.

@pront
Copy link
Copy Markdown
Member

pront commented Mar 17, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Member

@pront pront left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Looks good. Please address the merge conflicts.

@naa0yama naa0yama force-pushed the feat/geoip-enrichment-table-add-CIDR branch from e09c769 to 1501fce Compare March 17, 2026 16:57
@naa0yama
Copy link
Copy Markdown
Contributor Author

@pront

Thank you for your reply.
I've tried to resolve the conflict. Please check it.

@github-actions github-actions Bot removed the domain: external docs Anything related to Vector's external, public documentation label Mar 17, 2026
@pront pront enabled auto-merge March 17, 2026 18:22
@pront pront added this pull request to the merge queue Mar 17, 2026
Merged via the queue into vectordotdev:master with commit 089db67 Mar 17, 2026
57 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhanced CIDR enrichment with GeoIP and mmdb

3 participants