There's so many way to send logs to an elk... logspout, filebeat, journalbeat, etc.
But docker has a gelf log driver and logstash a gelf input. So here we are.
Here is a docker-compose to test a full elk with a container sending logs via gelf.
| #!/bin/bash | |
| export AWS_PROFILE=$(zenity --list $(cat ~/.aws/config | grep profile | sed 's/profile //g' | sed 's/\[//g' | sed 's/\]//g' | sort) --column="" --text="Select a Profile" --title="AWS Profile Selection") | |
| echo "${AWS_PROFILE}" | |
| # Call the script with either "source awspr" or ". awspr" after placing the script in your path and making it executable | |
| # Or add an alias by adding the following line to your .bashrc | |
| # alias awsp=". awspr" |
| // tweaked from: https://stackoverflow.com/a/42718113/1170664 | |
| func getXML(url string) ([]byte, error) { | |
| resp, err := http.Get(url) | |
| if err != nil { | |
| return []byte{}, fmt.Errorf("GET error: %v", err) | |
| } | |
| defer resp.Body.Close() | |
| if resp.StatusCode != http.StatusOK { | |
| return []byte{}, fmt.Errorf("Status error: %v", resp.StatusCode) |
There's so many way to send logs to an elk... logspout, filebeat, journalbeat, etc.
But docker has a gelf log driver and logstash a gelf input. So here we are.
Here is a docker-compose to test a full elk with a container sending logs via gelf.
| def getFolderName() { | |
| def array = pwd().split("/") | |
| return array[array.length - 2]; | |
| } | |
| node(){ | |
| stage 'Get Folder Name' | |
| def foldername = getFolderName() | |
| print "${foldername}" |
| import jenkins.model.Jenkins; | |
| import hudson.model.FreeStyleProject; | |
| import hudson.tasks.Shell; | |
| job = Jenkins.instance.createProject(FreeStyleProject, 'job-name') | |
| job.buildersList.add(new Shell('echo hello world')) | |
| job.save() |
| #!/bin/bash | |
| echo "This is a idle script (infinite loop) to keep container running." | |
| echo "Please replace this script." | |
| cleanup () | |
| { | |
| kill -s SIGTERM $! | |
| exit 0 | |
| } |