Skip to content

Instantly share code, notes, and snippets.

@michaellihs
Last active February 9, 2023 15:56
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save michaellihs/aac382b4072354b4b39812b57bd6c55f to your computer and use it in GitHub Desktop.
Save michaellihs/aac382b4072354b4b39812b57bd6c55f to your computer and use it in GitHub Desktop.
ElasticSearch, Logstash & Kibana for Jenkins Logs

Jenkins Logs in ElasticSearch

@paulwilljones
Copy link

Have you been able to output logs from pipeline jobs?

@undrafted
Copy link

Getting connection refused from jenkins -> elasticsearch. Any idea why?

@johnmj
Copy link

johnmj commented Aug 11, 2017

jenkins_logstash_setup
Hostname : http://localhost did not work whereas replacing it with the IP address works !
My setup is both Jenkins and ELK stack running as docker containers in the same host and no user configuration in ELK
P.S: Ignore the ERRORs

@MohanrajBabu
Copy link

MohanrajBabu commented May 16, 2019

Seems UI changed a bit, below are the configs I have tried in my local system:

logstash

This error thrown in jenkins build log.
[logstash-plugin]: Failed to send log data: http://172.17.0.3:9200.
[logstash-plugin]: No Further logs will be sent to http://172.17.0.3:9200.
java.io.IOException: HTTP error code: 405
URI: http://172.17.0.3:9200
RESPONSE: HttpResponseProxy{HTTP/1.1 405 Method Not Allowed [Allow: GET,DELETE,HEAD, content-type: application/json; charset=UTF-8] org.apache.http.client.entity.DecompressingEntity@a3cc166}
{"error":"Incorrect HTTP method for uri [/] and method [POST], allowed: [GET, DELETE, HEAD]","status":405}
at jenkins.plugins.logstash.persistence.ElasticSearchDao.push(ElasticSearchDao.java:199)
at jenkins.plugins.logstash.LogstashWriter.write(LogstashWriter.java:171)
at jenkins.plugins.logstash.LogstashWriter.write(LogstashWriter.java:105)
at jenkins.plugins.logstash.LogstashOutputStream.eol(LogstashOutputStream.java:64)
at hudson.console.LineTransformationOutputStream.eol(LineTransformationOutputStream.java:60)
at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:56)
at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:74)
at java.io.PrintStream.write(PrintStream.java:480)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104)
at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185)
at java.io.PrintStream.newLine(PrintStream.java:546)
at java.io.PrintStream.println(PrintStream.java:807)
at hudson.model.Cause$UserIdCause.print(Cause.java:457)
at hudson.model.BuildListener.started(BuildListener.java:49)
at hudson.model.Run.execute(Run.java:1798)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)

@donhongjia
Copy link

i have this problem too
java.io.IOException: HTTP error code: 405
URI: http://172.17.0.3:9200
RESPONSE: HttpResponseProxy{HTTP/1.1 405 Method Not Allowed [Allow: GET,DELETE,HEAD, content-type: application/json;

How to solve?

@RAKMAK
Copy link

RAKMAK commented Jul 18, 2019

try with URI as https://<elasticsearch_Host>:<elasticsearch_port>/logstash/jenkins

@rschaeferhig
Copy link

I was having the same error as above. I tried using https://<elasticsearch_Host>:<elasticsearch_port>/logstash/jenkins and now I get this error:

java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to J

@pradeeps
Copy link

pradeeps commented Jan 2, 2020

Just to close this thread, posting the solution,

You need to add /my_index/my_doc to the url like below

http://x.x.x.x:9200/my_index/my_doc

/my_index/my_doc is created on the first POST and you can find that in Kabana to create an index/dashboard

You can replace /my_index/my_doc with your own index/type.

/my_index/my_doc is "index" and "type"

@Indigenuity
Copy link

Getting connection refused from jenkins -> elasticsearch. Any idea why?

Because I know people are still out there experiencing this--the problems is likely that your elasticsearch process probably is only listening for incoming requests targeting localhost. Check out the network settings in elasticsearch.yml. You probably need to bind using a different network.host

@NaincyKumariKnoldus
Copy link

NaincyKumariKnoldus commented Feb 4, 2023

Hi, I am facing one issue in Kibana:
All the logs are coming to ElasticSearch. However, the index field names containing dots are getting empty values in Kibana.

Please help me. What should I do now?
@Indigenuity @pradeeps please help me.
image

@pradeeps
Copy link

pradeeps commented Feb 9, 2023

@NaincyKumariKnoldus the image is not visible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment