PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, October 24, 2022

[FIXED] How to provide api token based authentication to Logstash http input

 October 24, 2022     elasticsearch, elasticsearch-x-pack, logstash, logstash-configuration     No comments   

Issue

I'm have this simple logstash config, and I would like to add api-token auth to http input. I know how to do that for output to elastic search, but can't figure out is that possible to provide similar to http input

input {
    http {
        host => "0.0.0.0"
        port => 8080 # default: 8080
        ssl => false
    }
}

output {
    stdout {
        
    }
    elasticsearch {
        hosts => "elasticsearch:9200"
        api_key => "my_api_key"
        index => "my-local-index"
    }
}

Ideal request would be like

curl -d '{"message": "my log"}' -H 'Content-Type: application/json' -H 'Authorization: ApiKey my_api_key' http://localhost:8080

Solution

The http input creates an http server socket. That can support basic authorization using the user and password options for the input. It does not support using an elasticsearch API key.



Answered By - Badger
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing