Splunk Search

How do you match extracted CSV and index value and use geo values to visualize a map?

dannili
Communicator

I have index =s1 with a field called city, and an uploaded CSV file with fields like "office", "latitude" and "longitude". I wanted to find matching values where city == office and then use input lookup's latitude and longitude to visualize a map.

My search now is like this but it's not working.

index=s1 | append [| inputlookup cosco_mapping.csv | rex field=formatted_address "^(?<city>[^,]++)" | fields city, latitude, longitude ]  |  rex field=group_name "^(.*[\\\\])(?<office>.+)" | table office, city, latitude, longitude |   where office==city  | geostats latfield=latitude longfield=longitude count

Does anyone know how to solve this? Thanks!

0 Karma
1 Solution

sduff_splunk
Splunk Employee
Splunk Employee

In your query, you are not correlating your CSV data with the original indexed data. You may need to do a stats or a join to combine the indexed data with your CSV data.

Alternatively, have you tried using your CSV as a lookup?
index=s1 | lookup cosco_mapping.csv city AS office OUTPUT lattitude longitude

View solution in original post

0 Karma

sduff_splunk
Splunk Employee
Splunk Employee

In your query, you are not correlating your CSV data with the original indexed data. You may need to do a stats or a join to combine the indexed data with your CSV data.

Alternatively, have you tried using your CSV as a lookup?
index=s1 | lookup cosco_mapping.csv city AS office OUTPUT lattitude longitude

0 Karma

dannili
Communicator

Thanks for your response.This worked!

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...