File tree Expand file tree Collapse file tree 5 files changed +94
-0
lines changed Expand file tree Collapse file tree 5 files changed +94
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ name : Logstash Syntax
3+ on :
4+ push :
5+ tags :
6+ - v*
7+ branches :
8+ - main
9+ pull_request :
10+
11+ jobs :
12+ build :
13+ runs-on : ubuntu-latest
14+
15+ steps :
16+ - name : Check out code
17+ uses : actions/checkout@v2
18+
19+ - name : Install dependencies
20+ run : |
21+ sudo apt-get update
22+ sudo apt-get install gpg
23+ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
24+ echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list
25+ sudo apt-get update
26+ sudo apt-get install logstash
27+ mkdir -p /tmp/logstash/data /tmp/logstash/logs
28+
29+ - name : Test with Logstash
30+ run : |
31+ /usr/share/logstash/bin/logstash --path.settings /etc/logstash/ --path.config '*conf' --path.data /tmp/logstash/data --path.logs /tmp/logstash/logs --config.test_and_exit
Original file line number Diff line number Diff line change 1+ input.conf
2+ output.conf
Original file line number Diff line number Diff line change 11# ansible-logstash-pipeline
22Logstash pipeline for processing Ansible logs
3+
4+ [ ![ CI] ( https://github.com/netways/ansible-logstash-pipeline/workflows/Logstash%20Syntax/badge.svg?event=push )] ( https://github.com/netways/ansible-logstash-pipeline/actions?query=workflow%3A%22Logstash+Syntax%22 )
5+
6+ Minimalist pipeline to parse Ansible logs on managed hosts
7+
8+ Note, that Ansible uses it's module as part of the process name. So make the condition to route into this pipeline a regex check: ` [process][name] =~ "ansible" ` .
9+
10+ ## Inputs and Outputs ##
11+
12+ If you use files called ` input.conf ` and ` output.conf ` they will not collide with this rules, even when you want to pull new versions.
13+
14+ ### Examples ###
15+
16+ Here's an example for an ` input.conf `
17+
18+ ```
19+ input {
20+ redis {
21+ host => "localhost"
22+ data_type => "list"
23+ key => "netways-ansible-input"
24+ }
25+ }
26+ ```
27+
28+ and one for ` output.conf ` .
29+
30+ ```
31+ output {
32+ redis {
33+ host => "localhost"
34+ data_type => "list"
35+ key => "netways-ansible-output"
36+ }
37+ }
38+ ```
Original file line number Diff line number Diff line change 1+ filter {
2+ grok {
3+ match => ["[process][name]","ansible-%{GREEDYDATA:[ansible][module]:string}"]
4+ id => ansible_module
5+ tag_on_failure => ["_grokparsefailure","ansible_module_failed"]
6+ }
7+ }
Original file line number Diff line number Diff line change 1+ filter {
2+ # remove if if really *every* message starts like this
3+ if [message] =~ /Invoked with/ {
4+
5+ grok {
6+ match => ["message", "Invoked with %{GREEDYDATA:[@metadata][ansiblekv]}"]
7+ id => "ansible_invoked"
8+ tag_on_failure => ["_grokparsefailure","ansible_invoked_failed"]
9+ }
10+
11+ kv {
12+ source => "[@metadata][ansiblekv]"
13+ target => "ansible"
14+ id => "ansible_kv"
15+ # doesn't take array as tag_on_failure
16+ }
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments