Skip to content

an error occur when vector cant query geo info from geo_city_lite.mmdb #20476

Closed Answered by jszwedko
saltfishh asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @saltfishh ,

You can check for errors like:

  .geo_ip,err = get_enrichment_table_record("geoip_table",{"ip": .dissect.remote_ip})
  if (err !=null){
    .geo_ip={"city_name":"unknon"}
  }

That is: remove the ! from the function call. The ! tells VRL to abort if the function fails; otherwise it'll return an err value. This is documented here: https://vector.dev/docs/reference/vrl/expressions/#function-call

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by saltfishh
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
type: bug A code related bug.
2 participants
Converted from issue

This discussion was converted from issue #20475 on May 10, 2024 13:30.