QQAA
QQAA

Reputation: 47

Logstash not working with elastic

I am trying to upload data from a CSV file to my elastic cloud running on Google cloud using logstash pipeline. It returns an error-

input{
    file{
    path => "/Users/apple/Desktop/master.csv"
    start_position =>"beginning"
    sincedb_path= "/dev/null"
    }
}
filter{
    csv{
    separator => ","
    columns => {"Category", "Sub category", "Sub Sub Category", "Products", "Measure", "Price", 
    "Description",  "Gst"}
    }
    mutate{convert => ["Price", "float"] }
    mutate{convert => ["Gst", "float"] }
}
output{
    elasticsearch{
        hosts = "https://0acd1a298ea34dc1a28a974a302f2a7f.europe-west1.gcp.cloud.es.io:9243"
        username = "elastic"
        password = "**********"
        index => "masterdb"
        document_type => "product"

    }

}

The error is

Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #

What is expected one of #? Please help me to fix it.

Upvotes: 1

Views: 226

Answers (1)

baudsp
baudsp

Reputation: 4110

The error you're seeing (:ConfigurationError", :message=>"Expected one of #...) indicates at least one typo in your configuration.

I've cleaned up your config:

input{
    file{
    path => "/Users/apple/Desktop/master.csv"
    start_position =>"beginning"
    sincedb_path=> "/dev/null"
    }
}
filter{
    csv{
    separator => ","
    columns => ["Category", "Sub category", "Sub Sub Category", "Products", "Measure", "Price", "Description",  "Gst"]
    }
    mutate{convert => ["Price", "float"] }
    mutate{convert => ["Gst", "float"] }
}
output{
    elasticsearch{
        hosts => "https://0acd1a298ea34dc1a28a974a302f2a7f.europe-west1.gcp.cloud.es.io:9243"
        user => "elastic"
        password => "**********"
        index => "masterdb"
        document_type => "product"
    }
}

There were some => which were mistyped as =, the columns option in the csv filter has to be put between brackets, since there's more than one column and the username option doesn't exist in the elasticseach configuration.

Upvotes: 1

Related Questions