Data ingestion from API

Hi Everyone,

I am trying to pull Live data from a alarm monitoring tool API which is TrueSight .

Can anyone help me with how I can start, because this is the first time I am trying to use api calling method in Logstash and have no idea where to start .

Appreciate your help .

BR

Use this input filter

Hey Yassine,

below is my Config file and error

input {
    http_poller{
        urls=>{
            urlname=> "https://mprw100.prod.mobily.lan/tsws/10.0/api/authenticate/login"
            method => post
            user =>'ssp.rayudu.mandiga'
            password => 'ssp.rayudu66506'
            tenantName=>'BmcRealm'
             headers => {
          Accept => "application/json"
        }
        }
    request_timeout =>60
    schedule => {every=>"20s"}
    codec => 'json'
    metadata_target => "http_poller_metadata"
    }
}
    
output{
    elasticsearch {
        hosts => "http://localhost:9200"
        index => "api1"
    }
stdout {codec => rubydebug}
}

Below is the error

[2020-11-04T15:05:00,104][ERROR][logstash.agent           ] Failed to execute action {:id=>:main, :action_type=>LogStash::ConvergeResult::FailedAction, :message=>"Could not execute action: PipelineAction::Create<main>, action_result: false", :backtrace=>nil}

I guess there are 2 steps :

  1. Get a token (authentification)
  2. Retrieve data

I'm not sure logstash can do both tasks in same pipeline

Yes , but authentication itself is not happening ..but the same thing when I tried with postman it is working (getting status code 200 and receiving a auth token also for every session )

I would suggest you try

input {
    http_poller{
        urls=>{
            urlname=> "https://mprw100.prod.mobily.lan/tsws/10.0/api/authenticate/login?username=xxx&password=zzz&tenantname=vvvv"
            method => post
             headers => {
          Accept => "application/json"
        }
        }
    request_timeout =>60
    schedule => {every=>"20s"}
    codec => 'json'
    metadata_target => "http_poller_metadata"
    }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.