I am trying to use an API url to get data from a source.
My api has a custom Header for aw-tenant-code, which works well with a curl.
Here is my sample data:
input {
http_poller {
urls => {
snowsr => {
url => "https://url.com/API/system/users/enrolleddevices/search"
user => "elk"
password => "********"
headers => {
Accept => "application/json"
aw-tenant-code => "TN37b6rpCi7hJZkdGINQkDukaxccv5bRYOELNm0xB2I="
}
}
}
request_timeout => 60
metadata_target => "http_poller_metadata"
schedule => { cron => "* * * * *"}
#codec => "json"
}
}
output {
elasticsearch {
hosts => ["16.75.729:9200"]
index => "workspace"
}
stdout { codec => rubydebug }
}
Sample data in data source:
{
"EnrolledDeviceInfoList":[
{
"DeviceID":24,
"SerialNumber":"FVJ1WT",
"AssetNumber":"8D1ACE6812",
"FriendlyName":"MacBook Air",
"UserName":"UM2",
"EnrolledDate":"03/02/2020 16:05:22",
"RegistrationDate":"01/01/0001 00:00:00",
"LastSeen":"06/14/2020 07:59:01",
"Platform":"AppleOsX",
"OrganizationGroup":"Corp",
"CustomAttributes":[
]
},
{
"DeviceID":104,
"SerialNumber":"HT3",
"AssetNumber":"",
"FriendlyName":"Desktop Windows Desktop",
"UserName":"UWI",
"EnrolledDate":"02/11/2020 19:26:58",
"RegistrationDate":"01/01/0001 00:00:00",
"LastSeen":"06/16/2020 13:29:24",
"Platform":"WinRT",
"OrganizationGroup":"Corp",
"CustomAttributes":[
]
}
]
}
I get an error as below:
[2020-06-16T10:51:33,198][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:workspace, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of
#, => at line 10, column 4 (byte 237) after input {\n http_poller {\n urls => {\n snowsr => {\n url => \"https://url.com/API/system/users/enrolleddevices/search\"\n user
=> \"elk\"\n password => \"*********\"\n headers => {\n\tAccept => \"application/json\"\n\taw", :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:41:in `compile_imperative'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:49:in `compile_graph'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:11:in `block in compile_sources'", "org/jruby/RubyArray.java:2577:in `map'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:10:in `compile_sources'", "org/logstash/execution/AbstractPipelineExt.java:151:in `initialize'", "org/logstash/execution/JavaBasePipelineExt.java:47:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:24:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:36:in `execute'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:325:in `block in converge_state'"]}
What am i missing here? How do i split and get index for each device here. I am not sure why not one row of got loaded. Please help me.