Splunk Search

Location by Octet

sgtwolf1
Explorer

I have a Linux Environment and SSH is a thing here. I need to show SSH log in with location. I got the map to work but know I need to figure out how to show the IP's based on two locations based on the first two octets of the IP address schema.  

Example:

Texas: 192.168.x.x

California: 172.16.x.x 

 

index=Exampe_index "ssh" sourcetype="Example_audit" "res"=success type=USER_LOGIN hostname=*| iplocation addr | geostats latfield=lat longfield=lon count

 

 

sgtwolf1_0-1720445055823.png

 

Labels (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Consider using a lookup table that maps the first two octets to a location.  If the lookup returns the same fields as the iplocation command then you could use the geostats command to display the data on a map.  You probably would need to create a lookup definition and use the Advanced settings to define CIDR match on the address field.  The lookup might look something like this

addrCityCountryRegionlatlon
192.168.0.0/16fooUnited StatesTexasxxxyyy
172.168.0.0/16barUnited StatesCaliforniaaaabbb
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The iplocation command doesn't work with internal IP addresses (192.128.x.x, 10.x.x.x, etc.).  That's because many companies use the same IP address space so a lookup by IP alone is not meaningful.  Your company would have to create and install their own .mmdb file with the appropriate information.

---
If this reply helps you, Karma would be appreciated.
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Two or even three octets are insufficient to identify a location. What is it you are really trying to show?

0 Karma

sgtwolf1
Explorer

Thank you everyone for commenting. I have pre-defined location already based on the first two octets of the IP address schema. I thought there would be a way to identify location in that manner. Example 

 

Log in attempt from user1 from 192.168.x.x means they are coming from Texas 

Log in attempt from user2 from 172.168.x.x mean they are coming from California. 

 

Rember this are examples and I totally understand their local IP and geo tagging might not be possible since there internal IP. In this example we know the first two octas indicated California or Texas.  The idea is to have a dashboard for Linux users that shows a map of Authentication user taking place based on IP address. There is only two IP address scheme we are dealing with and only two locations in this example each corresponding to the location in the example 192.168.x.x is Texas and 172.168.x.x is California. Hope this helps:) Something like the below image:

sgtwolf1_0-1720450458765.png

 

 

 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Consider using a lookup table that maps the first two octets to a location.  If the lookup returns the same fields as the iplocation command then you could use the geostats command to display the data on a map.  You probably would need to create a lookup definition and use the Advanced settings to define CIDR match on the address field.  The lookup might look something like this

addrCityCountryRegionlatlon
192.168.0.0/16fooUnited StatesTexasxxxyyy
172.168.0.0/16barUnited StatesCaliforniaaaabbb
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

What's New in Splunk Enterprise 9.4: Features to Power Your Digital Resilience

Hey Splunky People! We are excited to share the latest updates in Splunk Enterprise 9.4. In this release we ...

Take Your Breath Away with Splunk Risk-Based Alerting (RBA)

WATCH NOW!The Splunk Guide to Risk-Based Alerting is here to empower your SOC like never before. Join Haylee ...

SignalFlow: What? Why? How?

What is SignalFlow? Splunk Observability Cloud’s analytics engine, SignalFlow, opens up a world of in-depth ...