Skip to content
Snippets Groups Projects
Commit ed06b9a4 authored by Stefano Di Frischia's avatar Stefano Di Frischia
Browse files

L2SS-970: fix logstash pipeline

parent 070e8409
No related branches found
No related tags found
1 merge request!447Resolve L2SS-970 "Add loki instance"
Showing
with 18 additions and 139 deletions
...@@ -12,7 +12,7 @@ datasources: ...@@ -12,7 +12,7 @@ datasources:
# <string> custom UID which can be used to reference this datasource in other parts of the configuration, if not specified will be generated automatically # <string> custom UID which can be used to reference this datasource in other parts of the configuration, if not specified will be generated automatically
uid: loki uid: loki
# <string> url # <string> url
url: loki:3100 url: http://loki:3100
# <string> Deprecated, use secureJsonData.password # <string> Deprecated, use secureJsonData.password
password: password:
# <string> database user, if used # <string> database user, if used
......
ARG SOURCE_IMAGE ARG SOURCE_IMAGE
FROM ${SOURCE_IMAGE} FROM ${SOURCE_IMAGE}
# Disable Elastic Search connection
ENV ELASTIC_CONTAINER=false
# Provide our logstash config # Provide our logstash config
ADD logstash /etc/logstash/
COPY loki.conf /home/logstash/ COPY loki.conf /home/logstash/
COPY loki.conf /home/logstash/loki-test.conf COPY logstash.yml /usr/share/logstash/config/logstash.yml
COPY loki.conf /usr/share/logstash/pipeline/logstash.conf
http.host: "0.0.0.0"
#xpack.monitoring.elasticsearch.hosts: [ "http://loki:3100" ]
input {
beats {
port => 5044
ssl => true
ssl_certificate => "/etc/pki/tls/certs/logstash-beats.crt"
ssl_key => "/etc/pki/tls/private/logstash-beats.key"
}
}
input {
syslog {
port => 1514
}
}
input {
tcp {
port => 5959
codec => json
}
}
filter {
if [type] == "syslog" {
grok {
match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}" }
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "received_from", "%{host}" ]
}
syslog_pri { }
date {
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
}
}
}
filter {
if [type] == "nginx-access" {
grok {
match => { "message" => "%{NGINXACCESS}" }
}
}
}
filter {
if [program] == "grafana" {
kv { }
mutate {
rename => {
"t" => "timestamp"
"lvl" => "level"
"msg" => "message"
}
uppercase => [ "level" ]
}
date {
match => [ "timestamp", "ISO8601" ]
}
}
}
filter {
if [program] == "prometheus" {
kv { }
mutate {
rename => {
"ts" => "timestamp"
"msg" => "message"
}
uppercase => [ "level" ]
}
date {
match => [ "timestamp", "ISO8601" ]
}
}
}
filter {
if [program] == "tango-rest" {
grok {
match => {
"message" => "%{TIMESTAMP_ISO8601:timestamp} %{WORD:level} %{GREEDYDATA:message}"
}
"overwrite" => [ "timestamp", "level", "message" ]
}
date {
match => [ "timestamp", "YYYY-MM-dd HH:mm:ss,SSS" ]
timezone => "UTC"
}
}
}
filter {
# mark all our mariadb instances
grok {
match => {
"program" => [ "archiver-maria-db", "tangodb" ]
}
add_tag => [ "mariadb" ]
}
# parse mariadb output
if "mariadb" in [tags] {
grok {
match => {
"message" => [
"%{TIMESTAMP_ISO8601:timestamp} .%{WORD:level}. %{GREEDYDATA:message}",
"%{TIMESTAMP_ISO8601:timestamp} 0 .%{WORD:level}. %{GREEDYDATA:message}"
]
}
"overwrite" => [ "timestamp", "level", "message" ]
}
mutate {
gsub => [
"level", "Note", "Info"
]
uppercase => [ "level" ]
}
date {
match => [ "timestamp", "YYYY-MM-dd HH:mm:ssZZ", "YYYY-MM-dd HH:mm:ss", "YYYY-MM-dd H:mm:ss" ]
timezone => "UTC"
}
}
}
output {
# elasticsearch {
# hosts => ["localhost"]
# manage_template => false
# index => "logstash-%{+YYYY.MM.dd}"
# }
loki {
url => "http://loki:3100/loki/api/v1/push"
}
}
input { input {
beats { beats {
port => 5044 port => 5044
ssl => true # ssl => true
ssl_certificate => "/etc/pki/tls/certs/logstash-beats.crt" # ssl_certificate => "/etc/pki/tls/certs/logstash-beats.crt"
ssl_key => "/etc/pki/tls/private/logstash-beats.key" # ssl_key => "/etc/pki/tls/private/logstash-beats.key"
} }
} }
...@@ -34,13 +34,13 @@ filter { ...@@ -34,13 +34,13 @@ filter {
} }
} }
filter { # filter {
if [type] == "nginx-access" { # if [type] == "nginx-access" {
grok { # grok {
match => { "message" => "%{NGINXACCESS}" } # match => { "message" => "%{NGINXACCESS}" }
} # }
} # }
} # }
filter { filter {
if [program] == "grafana" { if [program] == "grafana" {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment