SlideShare una empresa de Scribd logo
1 de 70
Descargar para leer sin conexión
Logstash
Integration
+
Origins
‣ Jordan Sissel
‣ Started in 2009
‣ Open Source (Apache License)
‣ Jordan joined Elastic in August 2013
‣ Still Open Source
‣ Will always be Open Source
What is it?
‣ A tool for receiving, processing and outputting
logs, and other data streams.
‣ Pipeline
‣ Input
‣ Filter
‣ Output
Inputs
• couchdb_changes
• drupal_dblog
• elasticsearch
• exec
• eventlog
• file
• ganglia
• gelf
• generator
• graphite
• github
• heartbeat
• heroku
• http
• http_poller
• irc
• imap
• jdbc
• jmx
• kafka
• log4j
• lumberjack
• meetup
• pipe
• syslog
• tcp
• twitter
• unix
• udp
• varnishlog
• wmi
• websocket
• xmpp
• zenoss
• zeromq
• puppet_facter
• relp
• rss
• rackspace
• rabbitmq
• redis
• snmptrap
• stdin
• sqlite
• s3
• sqs
• stomp
Filters
• aggregate
• alter
• anonymize
• collate
• csv
• cidr
• clone
• cipher
• checksum
• date
• dns
• syslog_pri
• sleep
• split
• throttle
• translate
• uuid
• urldecode
• useragent
• xml
• zeromq
• json_encode
• kv
• mutate
• metrics
• multiline
• metaevent
• prune
• punct
• ruby
• range
• drop
• elasticsearch
• extractnumbers
• environment
• elapsed
• fingerprint
• geoip
• grok
• i18n
• json
Outputs
• boundary
• circonus
• csv
• cloudwatch
• datadog
• datadog_metrics
• email
• elasticsearch
• exec
• file
• google_bigquery
• google_cloud_storage
• ganglia
• gelf
• stomp
• statsd
• solr_http
• sns
• syslog
• stdout
• tcp
• udp
• webhdfs
• websocket
• xmpp
• zabbix
• zeromq
• nagios
• null
• nagios_nsca
• opentsdb
• pagerduty
• pipe
• riemann
• redmine
• rackspace
• rabbitmq
• redis
• riak
• s3
• sqs
• graphtastic
• graphite
• hipchat
• http
• irc
• influxdb
• juggernaut
• jira
• kafka
• lumberjack
• librato
• loggly
• mongodb
• metriccatcher
Configuration
input {
plugin_name { settings... }
}
filter {
plugin_name { settings... }
}
output {
plugin_name { settings... }
}
Inputs
file
Read events from a file in real-time,
like tail
file
file {
path => "/path/to/logfile"
}
tcp
Read from TCP socket
tcp
tcp {
host => "ip or hostname"
port => 12345
}
irc
Capture all or part of the
discussion in one or more IRC
channels.
irc
irc {
channels => [ "#zabbix" ]
host => "irc.freenode.org"
nick => "my_nickname"
port => 6667
}
Inputs
• couchdb_changes
• drupal_dblog
• elasticsearch
• exec
• eventlog
• file
• ganglia
• gelf
• generator
• graphite
• github
• heartbeat
• heroku
• http
• http_poller
• irc
• imap
• jdbc
• jmx
• kafka
• log4j
• lumberjack
• meetup
• pipe
• syslog
• tcp
• twitter
• unix
• udp
• varnishlog
• wmi
• websocket
• xmpp
• zenoss
• zeromq
• puppet_facter
• relp
• rss
• rackspace
• rabbitmq
• redis
• snmptrap
• stdin
• sqlite
• s3
• sqs
• stomp
Filters
grok
Parse arbitrary text and structure it.
grok
‣ Parse unstructured log data into something structured.
‣ Perfect for syslog, webserver, & db logs, and in general,
any log format that is generally written for humans.
‣ Ships with 120+ patterns. You can add your own trivially.
‣ For help building patterns to match your logs:
‣ http://grokconstructor.appspot.com/
‣ http://grokdebug.herokuapp.com
grok
55.3.244.1 GET /index.html 15824 0.043
filter {
grok {
match => { "message" => "%{IP:client} %{WORD:method}
%{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}" }
}
}
grok
‣ client: 55.3.244.1
‣ method: GET
‣ request: /index.html
‣ bytes: 15824
‣ duration: 0.043
grok
Oniguruma
‣ (?<field_name>the pattern here)
‣ (?<queue_id>[0-9A-F]{10,11})
Custom patterns_dir
‣ # contents of ./patterns/postfix:

POSTFIX_QUEUEID [0-9A-F]{10,11}
grok
Jan 1 06:25:43 mailserver14 postfix/cleanup[21403]: BEF25A72965: message-
id=<20130101142543.5828399CCAF@mailserver14.example.com>
filter {
grok {
patterns_dir => "./patterns"
match => { "message" => "%{SYSLOGBASE}
%{POSTFIX_QUEUEID:queue_id}: %{GREEDYDATA:syslog_message}" }
}
}
grok
‣ timestamp: Jan 1 06:25:43
‣ logsource: mailserver14
‣ program: postfix/cleanup
‣ pid: 21403
‣ queue_id: BEF25A72965
‣ syslog_message: message-
id=<20130101142543.5828399CCAF@mailserver14.example.com>
date
Convert string-based date formats
to date object for easy conversion
and export.
date
‣ syslog events usually have timestamps like this:
Apr 17 09:32:01
‣ You would use the date format MMM dd HH:mm:ss to
parse this.
‣ http://www.joda.org/joda-time/apidocs/org/joda/time/
format/DateTimeFormat.html
‣ Overwrites @timestamp by default
date
filter {
# ...grok, etc.
date {
match => [ "timestamp", "MMM dd HH:mm:ss" ]
remove_field => { "timestamp" }
locale => "en"
}
# ...other filters
}
date
‣ ISO8601 - should parse any valid ISO8601 timestamp, such
as 2011-04-19T03:44:01.103Z
‣ UNIX - will parse float or int value expressing unix time in
seconds since epoch like 1326149001.132 as well as
1326149001
‣ UNIX_MS - will parse int value expressing unix time in
milliseconds since epoch like 1366125117000
‣ TAI64N - will parse tai64n time values
geoip
Look up geographic information by
IP
geoip
geoip {
source => "clientip"
}
useragent
Parse useragent strings into fields.
useragent
useragent {
source => "useragent"
}
OR
if [useragent] != "" {
useragent { source => "useragent" }
}
Filters
• aggregate
• alter
• anonymize
• collate
• csv
• cidr
• clone
• cipher
• checksum
• date
• dns
• syslog_pri
• sleep
• split
• throttle
• translate
• uuid
• urldecode
• useragent
• xml
• zeromq
• json_encode
• kv
• mutate
• metrics
• multiline
• metaevent
• prune
• punct
• ruby
• range
• drop
• elasticsearch
• extractnumbers
• environment
• elapsed
• fingerprint
• geoip
• grok
• i18n
• json
Conditionals
if/then/else
if EXPRESSION {
...
} else if EXPRESSION {
...
} else {
...
}
expressions
Comparison operators:
• equality: ==, !=, <, >, <=, >=
• regexp: =~, !~
• inclusion: in, not in
Supported boolean operators:
• and, or, nand, xor
Supported unary operators:
• !
expressions
filter {
if [action] == "login" {
mutate { remove => "secret" }
}
}
expressions
output {
# Send production errors to Zabbix
if [loglevel] == "ERROR" and [deployment] ==
"production" {
zabbix {
...
}
}
}
expressions
if [foo] in [foobar] {
if [foo] in "foo" {
if "hello" in [greeting] {
if [foo] in ["hello", "world", "foo"] {
if [missing] in [alsomissing] {
if !("foo" in ["hello", "world"]) {
sprintf
‣ Reference field values within a string:
add_field => { "foo" => "%{bar}" }
add_field => { "foo_%{bar}" => "%{baz}" }
‣ Nested fields are referenced with square braces:
add_field => {
"foo" => "%{[@metadata][bar]"
}
zabbix
You know, for monitoring.
zabbix
‣ https://github.com/logstash-plugins/logstash-output-zabbix
‣ https://www.elastic.co/guide/en/logstash/current/plugins-outputs-zabbix.html
‣ Community plugin
‣ Deterministic (derives Zabbix host and key values from events)
‣ Installation:
bin/plugin install logstash-output-zabbix
zabbix
‣ zabbix_sender protocol
‣ Uses @timestamp
‣ Supports sending multiple values per event (most recently
added feature)
‣ Uses native ruby TCP calls (old version used zabbix_sender
binary)
‣ Does not support batching (don't overload your trappers)
options
‣ zabbix_host
‣ zabbix_key
‣ zabbix_value
‣ zabbix_server_host
‣ zabbix_server_port
‣ multi_value
‣ timeout
zabbix_host
‣ Type: String
‣ A single field name which holds the value you intend to
use as the Zabbix host name.
‣ Required value.
zabbix_key
‣ Type: String
‣ A single field name which holds the value you intend to
use as the Zabbix item key.
‣ Ignored if using multi_value, otherwise required.
zabbix_value
‣ Type: String
‣ A single field name which holds the value you intend to
send to zabbix_host's zabbix_key.
‣ Default: "message" (the whole, original log line)
‣ Ignored if using multi_value, otherwise required.
server
‣ zabbix_server_host
The IP or resolvable hostname where the Zabbix server is
running
Default: "localhost"
‣ zabbix_server_port
The port on which the Zabbix server is running
Default: 10051
multi_value
‣ Type: Array
‣ Ignores zabbix_key and zabbix_value.
‣ This can be visualized as:
[ key1, value1, key2, value2, ... keyN, valueN ]
‣ ...where key1 is an instance of zabbix_key, and value1
is an instance of zabbix_value.
‣ If the field referenced by any zabbix_key or
zabbix_value does not exist, that entry will be ignored.
timeout
‣ Type: Number
‣ The number of seconds to wait before giving up on a
connection to the Zabbix server.
‣ Default: 1
‣ This number should be very small, otherwise delays in
delivery of other outputs could result.
zabbix
output {
zabbix {
zabbix_server_host => "zabbix.example.com"
zabbix_host => "host_field"
zabbix_key => "key_field"
zabbix_value => "value_field"
}
# ... Other outputs
}
zabbix
output {
if [type] == "zabbix" {
zabbix {
zabbix_server_host => "zabbix.example.com"
zabbix_host => "host_field"
zabbix_key => "key_field"
zabbix_value => "value_field"
}
}
}
zabbix
output {
if [type] == "zabbix" {
zabbix {
zabbix_server_host => "zabbix.example.com"
zabbix_host => "host_field"
multi_value => [ "k1", "v1", "k2", "v2" ]
}
}
}
use cases
It's play time!
IRC
‣ Monitor IRC for catch word or phrase
‣ Send to Zabbix if the word is given
input
input {
irc {
channels => [ "#zabbix" ]
host => "irc.freenode.org"
nick => "howdy"
port => 6667
type => "irc"
}
}
filter
if [type] == "irc" {
if [message] =~ /^.*TESTING.*$/ {
mutate {
add_field => { "[@metadata][irc_key]" =>
"message" }
add_field => { "[@metadata][zabbix_host]" =>
"irc" }
add_tag => "testing"
}
}
output
if [type] == "irc" and "testing" in [tags] {
zabbix {
zabbix_server_host => "localhost"
zabbix_host => "[@metadata][zabbix_host]"
zabbix_key => "[@metadata][irc_key]"
zabbix_value => "message"
}
}
Result
Input (IRCCloud)
Output (Zabbix Frontend)
NGINX
‣ Capture NGINX logs for virtual hosts
‣ Watch for error codes (400 - 599)
‣ Send to Zabbix when one comes in
‣ Bonus: Send the client IP that generated the code
input
input {
file {
path => "/path/to/nxinx.log"
type => "nginx_json"
}
}
filter - pt.1
json {
source => "message"
remove_field => "message"
}
if [type] == "nginx_json" {
mutate {
replace => { "host" => "%{vhost}" }
remove_field => "vhost"
}
filter - pt.2
geoip { source => "clientip" }
if [useragent] != "" {
useragent { source => "useragent" }
}
if [referrer] == "-" {
mutate { remove_field => "referrer" }
}
filter - pt.3
if [status] >= 400 and [host] != "localhost" {
mutate {
add_field => {
"[@metadata][status_key]" => "status"
}
add_field => {
"[@metadata][clientip_key]" => "clientip"
}
filter - pt.4
add_field => {
"[@metadata][error]" => "error[%{status},]"
}
add_field => {
"[@metadata][counter]" => "1"
}
}
}
}
output - 1
if [type] == "nginx_json" {
if [status] >= 400 {
zabbix {
zabbix_server_host => "localhost"
zabbix_host => "host"
zabbix_key => "[@metadata][error]"
zabbix_value => "[@metadata][counter]"
}
zabbix host key value
fieldname host [@metadata][error] [@metadata][counter]
value untergeek.com error[404,] 1
output - 2
zabbix {
zabbix_server_host => "localhost"
zabbix_host => "host"
multi_value => [
"[@metadata][status_key]", "status",
"[@metadata][clientip_key]", "clientip"
]
}
Result
‣ Two kinds here:
Result
Result
‣ Just 404s
Conclusion
‣ https://www.elastic.co/guide/en/logstash/current/index.html
‣ https://github.com/elastic/logstash
‣ https://github.com/logstash-plugins/logstash-output-zabbix
‣ https://discuss.elastic.co/c/logstash
‣ #logstash on irc.freenode.org

Más contenido relacionado

La actualidad más candente

Health monitoring and dependency injection - CNUG November 2019
Health monitoring and dependency injection - CNUG November 2019Health monitoring and dependency injection - CNUG November 2019
Health monitoring and dependency injection - CNUG November 2019
Alex Thissen
 

La actualidad más candente (20)

Combining logs, metrics, and traces for unified observability
Combining logs, metrics, and traces for unified observabilityCombining logs, metrics, and traces for unified observability
Combining logs, metrics, and traces for unified observability
 
MQ入門
MQ入門MQ入門
MQ入門
 
Microsoft Graph APIを活用した社内アプリケーション開発
Microsoft Graph APIを活用した社内アプリケーション開発Microsoft Graph APIを活用した社内アプリケーション開発
Microsoft Graph APIを活用した社内アプリケーション開発
 
AlloyDBを触ってみた!(第33回PostgreSQLアンカンファレンス@オンライン 発表資料)
AlloyDBを触ってみた!(第33回PostgreSQLアンカンファレンス@オンライン 発表資料)AlloyDBを触ってみた!(第33回PostgreSQLアンカンファレンス@オンライン 発表資料)
AlloyDBを触ってみた!(第33回PostgreSQLアンカンファレンス@オンライン 発表資料)
 
Health monitoring and dependency injection - CNUG November 2019
Health monitoring and dependency injection - CNUG November 2019Health monitoring and dependency injection - CNUG November 2019
Health monitoring and dependency injection - CNUG November 2019
 
Bringing Kafka Without Zookeeper Into Production with Colin McCabe | Kafka Su...
Bringing Kafka Without Zookeeper Into Production with Colin McCabe | Kafka Su...Bringing Kafka Without Zookeeper Into Production with Colin McCabe | Kafka Su...
Bringing Kafka Without Zookeeper Into Production with Colin McCabe | Kafka Su...
 
3分でわかるAzureでのService Principal
3分でわかるAzureでのService Principal3分でわかるAzureでのService Principal
3分でわかるAzureでのService Principal
 
Monitoring MySQL Replication lag with Prometheus & pt-heartbeat
Monitoring MySQL Replication lag with Prometheus & pt-heartbeatMonitoring MySQL Replication lag with Prometheus & pt-heartbeat
Monitoring MySQL Replication lag with Prometheus & pt-heartbeat
 
Dynatrace
DynatraceDynatrace
Dynatrace
 
Gaming on aws 〜ゲームにおけるAWS最新活用術〜
Gaming on aws 〜ゲームにおけるAWS最新活用術〜Gaming on aws 〜ゲームにおけるAWS最新活用術〜
Gaming on aws 〜ゲームにおけるAWS最新活用術〜
 
Amazon SNS+SQSによる Fanoutシナリオの話
Amazon SNS+SQSによる Fanoutシナリオの話Amazon SNS+SQSによる Fanoutシナリオの話
Amazon SNS+SQSによる Fanoutシナリオの話
 
LINE Login総復習
LINE Login総復習LINE Login総復習
LINE Login総復習
 
PromQL Deep Dive - The Prometheus Query Language
PromQL Deep Dive - The Prometheus Query Language PromQL Deep Dive - The Prometheus Query Language
PromQL Deep Dive - The Prometheus Query Language
 
Serverless時代のJavaについて
Serverless時代のJavaについてServerless時代のJavaについて
Serverless時代のJavaについて
 
ストリーム処理勉強会 大規模mqttを支える技術
ストリーム処理勉強会 大規模mqttを支える技術ストリーム処理勉強会 大規模mqttを支える技術
ストリーム処理勉強会 大規模mqttを支える技術
 
ストリーム処理を支えるキューイングシステムの選び方
ストリーム処理を支えるキューイングシステムの選び方ストリーム処理を支えるキューイングシステムの選び方
ストリーム処理を支えるキューイングシステムの選び方
 
NVIDIA 入門
NVIDIA 入門NVIDIA 入門
NVIDIA 入門
 
backlogsでもCI/CDする夢を見る
backlogsでもCI/CDする夢を見るbacklogsでもCI/CDする夢を見る
backlogsでもCI/CDする夢を見る
 
Monitoring the ELK stack using Zabbix and Grafana (Dennis Kanbier / 26-11-2015)
Monitoring the ELK stack using Zabbix and Grafana (Dennis Kanbier / 26-11-2015)Monitoring the ELK stack using Zabbix and Grafana (Dennis Kanbier / 26-11-2015)
Monitoring the ELK stack using Zabbix and Grafana (Dennis Kanbier / 26-11-2015)
 
マルチテナントのアプリケーション実装〜実践編〜
マルチテナントのアプリケーション実装〜実践編〜マルチテナントのアプリケーション実装〜実践編〜
マルチテナントのアプリケーション実装〜実践編〜
 

Similar a Aaron Mildenstein - Using Logstash with Zabbix

London devops logging
London devops loggingLondon devops logging
London devops logging
Tomas Doran
 
Serving Deep Learning Models At Scale With RedisAI: Luca Antiga
Serving Deep Learning Models At Scale With RedisAI: Luca AntigaServing Deep Learning Models At Scale With RedisAI: Luca Antiga
Serving Deep Learning Models At Scale With RedisAI: Luca Antiga
Redis Labs
 

Similar a Aaron Mildenstein - Using Logstash with Zabbix (20)

ELK stack at weibo.com
ELK stack at weibo.comELK stack at weibo.com
ELK stack at weibo.com
 
ETL with SPARK - First Spark London meetup
ETL with SPARK - First Spark London meetupETL with SPARK - First Spark London meetup
ETL with SPARK - First Spark London meetup
 
Devoxx france 2015 influxdb
Devoxx france 2015 influxdbDevoxx france 2015 influxdb
Devoxx france 2015 influxdb
 
Devoxx france 2015 influx db
Devoxx france 2015 influx dbDevoxx france 2015 influx db
Devoxx france 2015 influx db
 
Apache Spark v3.0.0
Apache Spark v3.0.0Apache Spark v3.0.0
Apache Spark v3.0.0
 
Matt Jarvis - Unravelling Logs: Log Processing with Logstash and Riemann
Matt Jarvis - Unravelling Logs: Log Processing with Logstash and Riemann Matt Jarvis - Unravelling Logs: Log Processing with Logstash and Riemann
Matt Jarvis - Unravelling Logs: Log Processing with Logstash and Riemann
 
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
 
(Fios#02) 2. elk 포렌식 분석
(Fios#02) 2. elk 포렌식 분석(Fios#02) 2. elk 포렌식 분석
(Fios#02) 2. elk 포렌식 분석
 
Wider than rails
Wider than railsWider than rails
Wider than rails
 
Logstash
LogstashLogstash
Logstash
 
London devops logging
London devops loggingLondon devops logging
London devops logging
 
OSDC 2016 - Unifying Logs and Metrics Data with Elastic Beats by Monica Sarbu
OSDC 2016 - Unifying Logs and Metrics Data with Elastic Beats by Monica SarbuOSDC 2016 - Unifying Logs and Metrics Data with Elastic Beats by Monica Sarbu
OSDC 2016 - Unifying Logs and Metrics Data with Elastic Beats by Monica Sarbu
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
 
Running Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on HadoopRunning Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on Hadoop
 
Vert.x v3 - high performance polyglot application toolkit
Vert.x v3 - high performance  polyglot application toolkitVert.x v3 - high performance  polyglot application toolkit
Vert.x v3 - high performance polyglot application toolkit
 
Serving Deep Learning Models At Scale With RedisAI: Luca Antiga
Serving Deep Learning Models At Scale With RedisAI: Luca AntigaServing Deep Learning Models At Scale With RedisAI: Luca Antiga
Serving Deep Learning Models At Scale With RedisAI: Luca Antiga
 
CNIT 50: 6. Command Line Packet Analysis Tools
CNIT 50: 6. Command Line Packet Analysis ToolsCNIT 50: 6. Command Line Packet Analysis Tools
CNIT 50: 6. Command Line Packet Analysis Tools
 
Scaling ingest pipelines with high performance computing principles - Rajiv K...
Scaling ingest pipelines with high performance computing principles - Rajiv K...Scaling ingest pipelines with high performance computing principles - Rajiv K...
Scaling ingest pipelines with high performance computing principles - Rajiv K...
 
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak   CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
 
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
 

Más de Zabbix

Más de Zabbix (20)

Zabbix Conference LatAm 2016 - Jessian Ferreira - Wireless with Zabbix
Zabbix Conference LatAm 2016 - Jessian Ferreira - Wireless with ZabbixZabbix Conference LatAm 2016 - Jessian Ferreira - Wireless with Zabbix
Zabbix Conference LatAm 2016 - Jessian Ferreira - Wireless with Zabbix
 
Zabbix Conference LatAm 2016 - Andre Deo - Zabbix Brazil Community
Zabbix Conference LatAm 2016 - Andre Deo - Zabbix Brazil CommunityZabbix Conference LatAm 2016 - Andre Deo - Zabbix Brazil Community
Zabbix Conference LatAm 2016 - Andre Deo - Zabbix Brazil Community
 
Zabbix Conference LatAm 2016 - Jorge Pretel - Low Level Discovery for ODBC an...
Zabbix Conference LatAm 2016 - Jorge Pretel - Low Level Discovery for ODBC an...Zabbix Conference LatAm 2016 - Jorge Pretel - Low Level Discovery for ODBC an...
Zabbix Conference LatAm 2016 - Jorge Pretel - Low Level Discovery for ODBC an...
 
Zabbix Conference LatAm 2016 - Andre Deo - SNMP and Zabbix
Zabbix Conference LatAm 2016 - Andre Deo - SNMP and ZabbixZabbix Conference LatAm 2016 - Andre Deo - SNMP and Zabbix
Zabbix Conference LatAm 2016 - Andre Deo - SNMP and Zabbix
 
Zabbix Conference LatAm 2016 - Rodrigo Mohr - Challenges on Large Env with Or...
Zabbix Conference LatAm 2016 - Rodrigo Mohr - Challenges on Large Env with Or...Zabbix Conference LatAm 2016 - Rodrigo Mohr - Challenges on Large Env with Or...
Zabbix Conference LatAm 2016 - Rodrigo Mohr - Challenges on Large Env with Or...
 
Zabbix Conference LatAm 2016 - Marcio Prop - Monitoring Complex Environments ...
Zabbix Conference LatAm 2016 - Marcio Prop - Monitoring Complex Environments ...Zabbix Conference LatAm 2016 - Marcio Prop - Monitoring Complex Environments ...
Zabbix Conference LatAm 2016 - Marcio Prop - Monitoring Complex Environments ...
 
Zabbix Conference LatAm 2016 - Daniel Nasiloski - Extending Zabbix - Interact...
Zabbix Conference LatAm 2016 - Daniel Nasiloski - Extending Zabbix - Interact...Zabbix Conference LatAm 2016 - Daniel Nasiloski - Extending Zabbix - Interact...
Zabbix Conference LatAm 2016 - Daniel Nasiloski - Extending Zabbix - Interact...
 
Zabbix Conference LatAm 2016 - Filipe Paternot - Zbx@Globo Automation+Integra...
Zabbix Conference LatAm 2016 - Filipe Paternot - Zbx@Globo Automation+Integra...Zabbix Conference LatAm 2016 - Filipe Paternot - Zbx@Globo Automation+Integra...
Zabbix Conference LatAm 2016 - Filipe Paternot - Zbx@Globo Automation+Integra...
 
Zabbix Conference LatAm 2016 - Douglas Esteves - Zabbix at UNICAMP
Zabbix Conference LatAm 2016 - Douglas Esteves - Zabbix at UNICAMPZabbix Conference LatAm 2016 - Douglas Esteves - Zabbix at UNICAMP
Zabbix Conference LatAm 2016 - Douglas Esteves - Zabbix at UNICAMP
 
Ryan Armstrong - Monitoring More Than 6000 Devices in Zabbix | ZabConf2016
Ryan Armstrong - Monitoring More Than 6000 Devices in Zabbix | ZabConf2016Ryan Armstrong - Monitoring More Than 6000 Devices in Zabbix | ZabConf2016
Ryan Armstrong - Monitoring More Than 6000 Devices in Zabbix | ZabConf2016
 
Rafael Martinez Guerrero - Zabbix at the University of Oslo | ZabConf2016
Rafael Martinez Guerrero - Zabbix at the University of Oslo | ZabConf2016Rafael Martinez Guerrero - Zabbix at the University of Oslo | ZabConf2016
Rafael Martinez Guerrero - Zabbix at the University of Oslo | ZabConf2016
 
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
 
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
 
Sumit Goel - Monitoring Cloud Applications Using Zabbix | ZabConf2016
Sumit Goel - Monitoring Cloud Applications Using Zabbix | ZabConf2016Sumit Goel - Monitoring Cloud Applications Using Zabbix | ZabConf2016
Sumit Goel - Monitoring Cloud Applications Using Zabbix | ZabConf2016
 
Rihards Olups - Zabbix at Nokia - Case Study
Rihards Olups - Zabbix at Nokia - Case StudyRihards Olups - Zabbix at Nokia - Case Study
Rihards Olups - Zabbix at Nokia - Case Study
 
Raymond Kuiper - Zen and The Art of Zabbix Template Design | ZabConf2016
Raymond Kuiper - Zen and The Art of Zabbix Template Design | ZabConf2016Raymond Kuiper - Zen and The Art of Zabbix Template Design | ZabConf2016
Raymond Kuiper - Zen and The Art of Zabbix Template Design | ZabConf2016
 
Dimitri Bellini and Pietro Antonacci - Manage Zabbix Proxies in Remote Networ...
Dimitri Bellini and Pietro Antonacci - Manage Zabbix Proxies in Remote Networ...Dimitri Bellini and Pietro Antonacci - Manage Zabbix Proxies in Remote Networ...
Dimitri Bellini and Pietro Antonacci - Manage Zabbix Proxies in Remote Networ...
 
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
 
Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016
Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016
Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016
 
Lukáš Malý - Log management ELISA controlled by Zabbix | ZabConf2016
Lukáš Malý - Log management ELISA controlled by Zabbix | ZabConf2016Lukáš Malý - Log management ELISA controlled by Zabbix | ZabConf2016
Lukáš Malý - Log management ELISA controlled by Zabbix | ZabConf2016
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Aaron Mildenstein - Using Logstash with Zabbix

  • 2. Origins ‣ Jordan Sissel ‣ Started in 2009 ‣ Open Source (Apache License) ‣ Jordan joined Elastic in August 2013 ‣ Still Open Source ‣ Will always be Open Source
  • 3. What is it? ‣ A tool for receiving, processing and outputting logs, and other data streams. ‣ Pipeline ‣ Input ‣ Filter ‣ Output
  • 4. Inputs • couchdb_changes • drupal_dblog • elasticsearch • exec • eventlog • file • ganglia • gelf • generator • graphite • github • heartbeat • heroku • http • http_poller • irc • imap • jdbc • jmx • kafka • log4j • lumberjack • meetup • pipe • syslog • tcp • twitter • unix • udp • varnishlog • wmi • websocket • xmpp • zenoss • zeromq • puppet_facter • relp • rss • rackspace • rabbitmq • redis • snmptrap • stdin • sqlite • s3 • sqs • stomp
  • 5. Filters • aggregate • alter • anonymize • collate • csv • cidr • clone • cipher • checksum • date • dns • syslog_pri • sleep • split • throttle • translate • uuid • urldecode • useragent • xml • zeromq • json_encode • kv • mutate • metrics • multiline • metaevent • prune • punct • ruby • range • drop • elasticsearch • extractnumbers • environment • elapsed • fingerprint • geoip • grok • i18n • json
  • 6. Outputs • boundary • circonus • csv • cloudwatch • datadog • datadog_metrics • email • elasticsearch • exec • file • google_bigquery • google_cloud_storage • ganglia • gelf • stomp • statsd • solr_http • sns • syslog • stdout • tcp • udp • webhdfs • websocket • xmpp • zabbix • zeromq • nagios • null • nagios_nsca • opentsdb • pagerduty • pipe • riemann • redmine • rackspace • rabbitmq • redis • riak • s3 • sqs • graphtastic • graphite • hipchat • http • irc • influxdb • juggernaut • jira • kafka • lumberjack • librato • loggly • mongodb • metriccatcher
  • 7. Configuration input { plugin_name { settings... } } filter { plugin_name { settings... } } output { plugin_name { settings... } }
  • 9. file Read events from a file in real-time, like tail
  • 10. file file { path => "/path/to/logfile" }
  • 12. tcp tcp { host => "ip or hostname" port => 12345 }
  • 13. irc Capture all or part of the discussion in one or more IRC channels.
  • 14. irc irc { channels => [ "#zabbix" ] host => "irc.freenode.org" nick => "my_nickname" port => 6667 }
  • 15. Inputs • couchdb_changes • drupal_dblog • elasticsearch • exec • eventlog • file • ganglia • gelf • generator • graphite • github • heartbeat • heroku • http • http_poller • irc • imap • jdbc • jmx • kafka • log4j • lumberjack • meetup • pipe • syslog • tcp • twitter • unix • udp • varnishlog • wmi • websocket • xmpp • zenoss • zeromq • puppet_facter • relp • rss • rackspace • rabbitmq • redis • snmptrap • stdin • sqlite • s3 • sqs • stomp
  • 17. grok Parse arbitrary text and structure it.
  • 18. grok ‣ Parse unstructured log data into something structured. ‣ Perfect for syslog, webserver, & db logs, and in general, any log format that is generally written for humans. ‣ Ships with 120+ patterns. You can add your own trivially. ‣ For help building patterns to match your logs: ‣ http://grokconstructor.appspot.com/ ‣ http://grokdebug.herokuapp.com
  • 19. grok 55.3.244.1 GET /index.html 15824 0.043 filter { grok { match => { "message" => "%{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}" } } }
  • 20. grok ‣ client: 55.3.244.1 ‣ method: GET ‣ request: /index.html ‣ bytes: 15824 ‣ duration: 0.043
  • 21. grok Oniguruma ‣ (?<field_name>the pattern here) ‣ (?<queue_id>[0-9A-F]{10,11}) Custom patterns_dir ‣ # contents of ./patterns/postfix:
 POSTFIX_QUEUEID [0-9A-F]{10,11}
  • 22. grok Jan 1 06:25:43 mailserver14 postfix/cleanup[21403]: BEF25A72965: message- id=<20130101142543.5828399CCAF@mailserver14.example.com> filter { grok { patterns_dir => "./patterns" match => { "message" => "%{SYSLOGBASE} %{POSTFIX_QUEUEID:queue_id}: %{GREEDYDATA:syslog_message}" } } }
  • 23. grok ‣ timestamp: Jan 1 06:25:43 ‣ logsource: mailserver14 ‣ program: postfix/cleanup ‣ pid: 21403 ‣ queue_id: BEF25A72965 ‣ syslog_message: message- id=<20130101142543.5828399CCAF@mailserver14.example.com>
  • 24. date Convert string-based date formats to date object for easy conversion and export.
  • 25. date ‣ syslog events usually have timestamps like this: Apr 17 09:32:01 ‣ You would use the date format MMM dd HH:mm:ss to parse this. ‣ http://www.joda.org/joda-time/apidocs/org/joda/time/ format/DateTimeFormat.html ‣ Overwrites @timestamp by default
  • 26. date filter { # ...grok, etc. date { match => [ "timestamp", "MMM dd HH:mm:ss" ] remove_field => { "timestamp" } locale => "en" } # ...other filters }
  • 27. date ‣ ISO8601 - should parse any valid ISO8601 timestamp, such as 2011-04-19T03:44:01.103Z ‣ UNIX - will parse float or int value expressing unix time in seconds since epoch like 1326149001.132 as well as 1326149001 ‣ UNIX_MS - will parse int value expressing unix time in milliseconds since epoch like 1366125117000 ‣ TAI64N - will parse tai64n time values
  • 28. geoip Look up geographic information by IP
  • 29. geoip geoip { source => "clientip" }
  • 31. useragent useragent { source => "useragent" } OR if [useragent] != "" { useragent { source => "useragent" } }
  • 32. Filters • aggregate • alter • anonymize • collate • csv • cidr • clone • cipher • checksum • date • dns • syslog_pri • sleep • split • throttle • translate • uuid • urldecode • useragent • xml • zeromq • json_encode • kv • mutate • metrics • multiline • metaevent • prune • punct • ruby • range • drop • elasticsearch • extractnumbers • environment • elapsed • fingerprint • geoip • grok • i18n • json
  • 34. if/then/else if EXPRESSION { ... } else if EXPRESSION { ... } else { ... }
  • 35. expressions Comparison operators: • equality: ==, !=, <, >, <=, >= • regexp: =~, !~ • inclusion: in, not in Supported boolean operators: • and, or, nand, xor Supported unary operators: • !
  • 36. expressions filter { if [action] == "login" { mutate { remove => "secret" } } }
  • 37. expressions output { # Send production errors to Zabbix if [loglevel] == "ERROR" and [deployment] == "production" { zabbix { ... } } }
  • 38. expressions if [foo] in [foobar] { if [foo] in "foo" { if "hello" in [greeting] { if [foo] in ["hello", "world", "foo"] { if [missing] in [alsomissing] { if !("foo" in ["hello", "world"]) {
  • 39. sprintf ‣ Reference field values within a string: add_field => { "foo" => "%{bar}" } add_field => { "foo_%{bar}" => "%{baz}" } ‣ Nested fields are referenced with square braces: add_field => { "foo" => "%{[@metadata][bar]" }
  • 40. zabbix You know, for monitoring.
  • 41. zabbix ‣ https://github.com/logstash-plugins/logstash-output-zabbix ‣ https://www.elastic.co/guide/en/logstash/current/plugins-outputs-zabbix.html ‣ Community plugin ‣ Deterministic (derives Zabbix host and key values from events) ‣ Installation: bin/plugin install logstash-output-zabbix
  • 42. zabbix ‣ zabbix_sender protocol ‣ Uses @timestamp ‣ Supports sending multiple values per event (most recently added feature) ‣ Uses native ruby TCP calls (old version used zabbix_sender binary) ‣ Does not support batching (don't overload your trappers)
  • 43. options ‣ zabbix_host ‣ zabbix_key ‣ zabbix_value ‣ zabbix_server_host ‣ zabbix_server_port ‣ multi_value ‣ timeout
  • 44. zabbix_host ‣ Type: String ‣ A single field name which holds the value you intend to use as the Zabbix host name. ‣ Required value.
  • 45. zabbix_key ‣ Type: String ‣ A single field name which holds the value you intend to use as the Zabbix item key. ‣ Ignored if using multi_value, otherwise required.
  • 46. zabbix_value ‣ Type: String ‣ A single field name which holds the value you intend to send to zabbix_host's zabbix_key. ‣ Default: "message" (the whole, original log line) ‣ Ignored if using multi_value, otherwise required.
  • 47. server ‣ zabbix_server_host The IP or resolvable hostname where the Zabbix server is running Default: "localhost" ‣ zabbix_server_port The port on which the Zabbix server is running Default: 10051
  • 48. multi_value ‣ Type: Array ‣ Ignores zabbix_key and zabbix_value. ‣ This can be visualized as: [ key1, value1, key2, value2, ... keyN, valueN ] ‣ ...where key1 is an instance of zabbix_key, and value1 is an instance of zabbix_value. ‣ If the field referenced by any zabbix_key or zabbix_value does not exist, that entry will be ignored.
  • 49. timeout ‣ Type: Number ‣ The number of seconds to wait before giving up on a connection to the Zabbix server. ‣ Default: 1 ‣ This number should be very small, otherwise delays in delivery of other outputs could result.
  • 50. zabbix output { zabbix { zabbix_server_host => "zabbix.example.com" zabbix_host => "host_field" zabbix_key => "key_field" zabbix_value => "value_field" } # ... Other outputs }
  • 51. zabbix output { if [type] == "zabbix" { zabbix { zabbix_server_host => "zabbix.example.com" zabbix_host => "host_field" zabbix_key => "key_field" zabbix_value => "value_field" } } }
  • 52. zabbix output { if [type] == "zabbix" { zabbix { zabbix_server_host => "zabbix.example.com" zabbix_host => "host_field" multi_value => [ "k1", "v1", "k2", "v2" ] } } }
  • 54. IRC ‣ Monitor IRC for catch word or phrase ‣ Send to Zabbix if the word is given
  • 55. input input { irc { channels => [ "#zabbix" ] host => "irc.freenode.org" nick => "howdy" port => 6667 type => "irc" } }
  • 56. filter if [type] == "irc" { if [message] =~ /^.*TESTING.*$/ { mutate { add_field => { "[@metadata][irc_key]" => "message" } add_field => { "[@metadata][zabbix_host]" => "irc" } add_tag => "testing" } }
  • 57. output if [type] == "irc" and "testing" in [tags] { zabbix { zabbix_server_host => "localhost" zabbix_host => "[@metadata][zabbix_host]" zabbix_key => "[@metadata][irc_key]" zabbix_value => "message" } }
  • 59. NGINX ‣ Capture NGINX logs for virtual hosts ‣ Watch for error codes (400 - 599) ‣ Send to Zabbix when one comes in ‣ Bonus: Send the client IP that generated the code
  • 60. input input { file { path => "/path/to/nxinx.log" type => "nginx_json" } }
  • 61. filter - pt.1 json { source => "message" remove_field => "message" } if [type] == "nginx_json" { mutate { replace => { "host" => "%{vhost}" } remove_field => "vhost" }
  • 62. filter - pt.2 geoip { source => "clientip" } if [useragent] != "" { useragent { source => "useragent" } } if [referrer] == "-" { mutate { remove_field => "referrer" } }
  • 63. filter - pt.3 if [status] >= 400 and [host] != "localhost" { mutate { add_field => { "[@metadata][status_key]" => "status" } add_field => { "[@metadata][clientip_key]" => "clientip" }
  • 64. filter - pt.4 add_field => { "[@metadata][error]" => "error[%{status},]" } add_field => { "[@metadata][counter]" => "1" } } } }
  • 65. output - 1 if [type] == "nginx_json" { if [status] >= 400 { zabbix { zabbix_server_host => "localhost" zabbix_host => "host" zabbix_key => "[@metadata][error]" zabbix_value => "[@metadata][counter]" } zabbix host key value fieldname host [@metadata][error] [@metadata][counter] value untergeek.com error[404,] 1
  • 66. output - 2 zabbix { zabbix_server_host => "localhost" zabbix_host => "host" multi_value => [ "[@metadata][status_key]", "status", "[@metadata][clientip_key]", "clientip" ] }
  • 70. Conclusion ‣ https://www.elastic.co/guide/en/logstash/current/index.html ‣ https://github.com/elastic/logstash ‣ https://github.com/logstash-plugins/logstash-output-zabbix ‣ https://discuss.elastic.co/c/logstash ‣ #logstash on irc.freenode.org