x
GeoIP Cribl Search

Performing Geolocation Lookups on IP Addresses to Use in Cribl Search

January 8, 2024
Written by
Igor Gifrin's Image

Igor is a Principal Security Solutions Engineer at Cribl. In the past 20+ years he has be... Read Moreen helping organizations to find the best, and, more importantly, the simplest solutions to their security and IT problems. He also builds tools like InfoSec app for Splunk used by 5000+ security teams. He is very passionate about getting sense out of all kinds of data, and has very strong opinions about vendors using ML and AI just because it is flashy. Read Less

Categories: Cribl Search, Engineering

Are you tired of sifting through data without context? Cribl Search adds valuable depth to your data, making it much easier to understand and analyze. No more squinting at cryptic logs or puzzling over unknown IP addresses! Some common examples of how Cribl Search can enrich your data are adding service names or matching to threat intelligence. Another popular data enrichment is adding geographical location to events based on IP addresses. This eliminates the need to decipher IPs – Cribl Search translates them into real-world locations, giving you a clearer picture of your data’s origin and flow.

We are jumping ahead a bit here, but with GeoIP data added to search results, we can also create maps showing the location of the IPs.

ip-lookup Search Operator

While pre-enriched data with GeoIP information is ideal, Cribl Search offers a powerful solution for data sources lacking such context. Pre-processing and enrichment may not be possible for voluminous or infrequently accessed data. Cribl Search elegantly addresses this challenge by enabling direct searches against data residing in diverse locations, eliminating the need for prior ingestion or even reshaping the event formats.

The ip-lookup operator lets you add GeoIP context during the search itself. This operator translates IP addresses into valuable location data, including country, city, and even geographical coordinates.

Steps to Add GeoIP Information

We’ll use a voluminous data source, cloud flow logs, in the examples below. The volume of those logs is often too high to send them to a legacy analytics solution that needs to ingest, process, and store all events whether you use them or not.

A sample flow event looks like this:

2 123456789012 eni-0b2fc5457066bc156 89.248.165.164 10.0.0.164 39540 1900 17 1 118 1702423898 1702423898 REJECT OK

In the next few steps we will enrich the public IP addresses from flow events like these, and visualize the results on a map.

If you’d like to follow along, log into your Cribl Cloud instance (or get a free Cribl Cloud account). We will use the sample data that is already provided in your Cribl Cloud instance.

After logging into the Cribl Cloud, go to Search and run this:

dataset=cribl_search_sample dataSource=vpcflowlogs | limit 1000

You will see 1,000 AWS VPC Flow Log events. Many of them will have public IP addresses.

Now we can add GeoIP lookup data. This takes just a couple of minutes. Sign up for the free MaxMind GeoLite2 database (you can also use other free or premium databases in MMDB format). Once you register, confirm your email, download the database, and go to Cribl Search > Data > Lookups > Add Lookup File to upload the GeoIP lookup to your Cribl Search instance. Make sure you are uploading the file with the .mmdb extension. Remember the file name you uploaded if it differs from GeoLite2-City.mmdb.

We are ready to use the ip-lookup search operator. Run this in Search:

dataset=cribl_search_sample dataSource=vpcflowlogs | limit 1000 | ip-lookup "GeoLite2-City" on srcaddr

In the list of fields on the left, and when you expand individual events, you will see new fields that did not exist before we added the ip-lookup operator: city, country, country_code, lat, lon, etc.

TIP: Don’t like jumping to another browser tab to look for documentation? Just hover over any operator in the search string to see more information on how to use it; also check out the provided examples at the end of the brief description.

Visualizing Data on a Map

Now, we can map our results. Let’s make our search more useful by adding action=REJECT and removing limit 1000 to see all rejected connections coming to us from across the globe. We will also add summarize count() by country to have a count of those connections by country:

dataset=cribl_search_sample dataSource=vpcflowlogs action=REJECT

| ip-lookup "GeoLite2-City" on srcaddr

| summarize count() by country

Selecting the Map visualization under Format > Chart > Type,

This will show us a choropleth map with rejected connections by country:

We are ready to add the map to a dashboard like in the example below so more users can see what’s happening in our environment at a glance.

Wrap up on adding GeoIP Data to Cribl Search

Many event types lack context. With Cribl Search, you can quickly add context to events such as geolocation. This increases the value of your data and saves time when analyzing logs. Data can be more useful to a larger audience when presented as a story with visualizations like maps on the Cribl Search dashboards.

If you haven’t done so, sign up for a free Cribl.Cloud account now and analyze your data with instant access to Cribl Search!


 

Cribl, the Data Engine for IT and Security, empowers organizations to transform their data strategy. Customers use Cribl’s suite of products to collect, process, route, and analyze all IT and security data, delivering the flexibility, choice, and control required to adapt to their ever-changing needs.

We offer free training, certifications, and a free tier across our products. Our community Slack features Cribl engineers, partners, and customers who can answer your questions as you get started and continue to build and evolve. We also offer a variety of hands-on Sandboxes for those interested in how companies globally leverage our products for their data challenges.

.
Blog
Feature Image

Mastering Tail Sampling for OpenTelemetry: Cost-Effective Strategies with Cribl

Read More
.
Blog
Feature Image

The Stream Life Podcast 110: Microsoft Azure + Cribl – Better together

Read More
.
Blog
Feature Image

Rethinking Security: Why Organizations are Flocking to Microsoft Sentinel

Read More
pattern

Try Your Own Cribl Sandbox

Experience a full version of Cribl Stream and Cribl Edge in the cloud with pre-made sources and destinations.

box

So you're rockin' Internet Explorer!

Classic choice. Sadly, our website is designed for all modern supported browsers like Edge, Chrome, Firefox, and Safari

Got one of those handy?