Splunk Search

Why is my search producing "Error in 'geostats' command: The argument 'lon1' is invalid."?

seregaserega
Explorer

Hi,

I'm trying to use the geostats command and got confusion.
I'm running my search without geostats:

some_stuff_here| fields some_field_with_value, lon1, lat1 

I see lon1, lat1 fields in output. They are valid float numbers. Then I try to apply geostats function:

some_stuff_here | fields some_field_with_value, lon1, lat1 
|  geostats latfield=lat1 longfield= lon1 sum(some_field_with_value)

** Error in 'geostats' command: The argument 'lon1' is invalid. **
What is the right way to debug that problem?

Tags (2)
0 Karma

acharlieh
Influencer

I think the space is what's tripping you up. I built a query to randomly generate some lat, long, and some_field_with_value events, and then apply geostats to it. On Splunk 6.2.3 this query fails with the same "Error in 'geostats' command: The argument 'lon1' is invalid." message:

| gentimes start=-1 increment=1h 
| eval lat1=(random()/(pow(2,31)-1)*180)-90 
| eval lon1=(random()/(pow(2,31)-1)*360)-180
| eval some_field_with_value=(random()/(pow(2,31)-1)*360)
| fields l* so*
| geostats latfield=lat1 longfield= lon1 sum(some_field_with_value)

On the same system, this query however works just fine:

| gentimes start=-1 increment=1h 
| eval lat1=(random()/(pow(2,31)-1)*180)-90 
| eval lon1=(random()/(pow(2,31)-1)*360)-180
| eval some_field_with_value=(random()/(pow(2,31)-1)*360)
| fields l* so*
| geostats latfield=lat1 longfield=lon1 sum(some_field_with_value)

Note the lack of space between the = and the name of the field in the working query.
spaaaaaceeee

dwaddle
SplunkTrust
SplunkTrust

SPAAAACE MAN

seregaserega
Explorer

??? x=y and x= y are not the same?

0 Karma

seregaserega
Explorer

So I added rename step to rename lon1, lat1 to lon, lat (default expected fields), Splunk started to run query. I'm confused. Doc says it's ok to tell geostats what fields keep longitude, latitude values.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...