Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually prepare mysql package (alpha) #323

Merged
merged 20 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
414 changes: 226 additions & 188 deletions dev/import-beats-resources/mysql/docs/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
input: log
paths:
{{#each paths}}
- {{this}}
{{/each}}
exclude_files: [".gz$"]
multiline:
# Consider lines without timestamp part of the previous message
pattern: '^([0-9]{4}-[0-9]{2}-[0-9]{2}|[0-9]{6})'
negate: true
match: after
processors:
- add_locale: ~
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
description: Pipeline for parsing MySQL error logs
processors:
- grok:
field: message
patterns:
- '%{MYSQLDATETIME}%{SPACE}(%{NUMBER:mysql.thread_id:long}%{SPACE})?(\[%{DATA:log.level}\]%{SPACE})?%{GREEDYMULTILINE:message}'
- '%{GREEDYDATA:message}'
ignore_missing: true
pattern_definitions:
LOCALDATETIME: (?:%{YEAR}-%{MONTHNUM}-%{MONTHDAY}|%{NUMBER})%{SPACE}%{TIME}
MYSQLDATETIME: (?:%{LOCALDATETIME:_tmp.local_timestamp}|%{TIMESTAMP_ISO8601:_tmp.timestamp})
GREEDYMULTILINE: |-
(.|
)+
- grok:
field: message
patterns:
- '(\[%{DATA:event.code}\])%{SPACE}(\[%{DATA:event.provider}\])%{SPACE}%{GREEDYMULTILINE}'
- '%{GREEDYDATA}'
ignore_missing: true
ignore_failure: true
pattern_definitions:
GREEDYMULTILINE: |-
(.|
)+
- rename:
field: '@timestamp'
target_field: event.created
- date:
if: ctx._tmp?.local_timestamp != null && ctx.event?.timezone == null
field: _tmp.local_timestamp
formats:
- yyMMdd H:m:s
- yyMMdd H:m:s
- yyyy-MM-dd H:m:s
- yyyy-MM-dd H:m:s
- date:
if: ctx._tmp?.local_timestamp != null && ctx.event?.timezone != null
field: _tmp.local_timestamp
timezone: '{{ event.timezone }}'
formats:
- yyMMdd H:m:s
- yyMMdd H:m:s
- yyyy-MM-dd H:m:s
- yyyy-MM-dd H:m:s
- date:
if: ctx._tmp?.timestamp != null
field: _tmp.timestamp
formats:
- ISO8601
- remove:
field: _tmp
ignore_missing: true
- set:
field: event.kind
value: event
- append:
field: event.category
value: database
- append:
field: event.type
value: info
- append:
field: event.type
value: error
if: "ctx?.log?.level != null && ctx.log.level.toLowerCase() == 'error'"
on_failure:
- set:
field: error.message
value: '{{ _ingest.on_failure_message }}'
20 changes: 20 additions & 0 deletions dev/packages/alpha/mysql-0.0.2/dataset/error/fields/ecs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- name: message
level: core
type: text
description: |-
For log events the message field contains the log message, optimized for viewing in a log viewer.
For structured logs without an original message field, other fields can be concatenated to form a human-readable summary of the event.
If multiple messages exist, they can be combined into one message.
- name: log
title: Log
group: 2
type: group
fields:
- name: level
level: core
type: keyword
description: |-
Original log level of the log event.
If the source of the event provides a log level or textual severity, this is the one that goes in `log.level`. If your source doesn't specify one, you may put your event transport's severity here (e.g. Syslog severity).
Some examples are `warn`, `err`, `i`, `informational`.
ignore_above: 1024
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: mysql.error
type: group
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- name: mysql
type: group
fields:
- name: thread_id
type: long
description: |
The connection or thread ID for the query.
23 changes: 23 additions & 0 deletions dev/packages/alpha/mysql-0.0.2/dataset/error/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
title: MySQL error logs
release: ga
type: logs
streams:
- input: logs
vars:
- name: paths
type: text
title: Error log paths
multi: true
required: true
show_user: true
default:
- /var/log/mysql/error.log*
- /var/log/mysqld.log*
os.darwin:
default:
- /usr/local/var/mysql/localhost.localdomain.err*
os.windows:
default:
- c:/programdata/MySQL/MySQL Server*/error.log*
title: MySQL error logs
description: Collect MySQL error logs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
input: mysql/metrics
metricsets: ["galera_status"]
hosts:
{{#each hosts}}
- {{this}}
{{/each}}
{{#if password}}
password: {{password}}
{{/if}}
period: {{period}}
{{#if raw}}
raw: {{raw}}
{{/if}}
{{#if username}}
username: {{username}}
{{/if}}
201 changes: 201 additions & 0 deletions dev/packages/alpha/mysql-0.0.2/dataset/galera_status/fields/fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
- name: mysql.galera_status
type: group
release: beta
fields:
- name: apply
type: group
fields:
- name: oooe
type: double
description: |
How often applier started write-set applying out-of-order (parallelization efficiency).
- name: oool
type: double
description: |
How often write-set was so slow to apply that write-set with higher seqno's were applied earlier. Values closer to 0 refer to a greater gap between slow and fast write-sets.
- name: window
type: double
description: |
Average distance between highest and lowest concurrently applied seqno.
- name: cert
type: group
fields:
- name: deps_distance
type: double
description: |
Average distance between highest and lowest seqno value that can be possibly applied in parallel (potential degree of parallelization).
- name: index_size
type: long
description: |
The number of entries in the certification index.
- name: interval
type: double
description: |
Average number of transactions received while a transaction replicates.
- name: cluster
type: group
fields:
- name: conf_id
type: long
description: |
Total number of cluster membership changes happened.
- name: size
type: long
description: |
Current number of members in the cluster.
- name: status
type: keyword
description: |
Status of this cluster component. That is, whether the node is part of a PRIMARY or NON_PRIMARY component.
- name: commit
type: group
fields:
- name: oooe
type: double
description: |
How often a transaction was committed out of order.
- name: window
type: long
description: |
Average distance between highest and lowest concurrently committed seqno.
- name: connected
type: keyword
description: |
If the value is OFF, the node has not yet connected to any of the cluster components. This may be due to misconfiguration. Check the error log for proper diagnostics.
- name: evs
type: group
fields:
- name: evict
type: keyword
description: |
Lists the UUID's of all nodes evicted from the cluster. Evicted nodes cannot rejoin the cluster until you restart their mysqld processes.
- name: state
type: keyword
description: |
Shows the internal state of the EVS Protocol.
- name: flow_ctl
type: group
fields:
- name: paused
type: double
description: |
The fraction of time since the last FLUSH STATUS command that replication was paused due to flow control. In other words, how much the slave lag is slowing down the cluster.
- name: paused_ns
type: long
description: |
The total time spent in a paused state measured in nanoseconds.
- name: recv
type: long
description: |
Returns the number of FC_PAUSE events the node has received, including those the node has sent. Unlike most status variables, the counter for this one does not reset every time you run the query.
- name: sent
type: long
description: |
Returns the number of FC_PAUSE events the node has sent. Unlike most status variables, the counter for this one does not reset every time you run the query.
- name: last_committed
type: long
description: |
The sequence number, or seqno, of the last committed transaction.
- name: local
type: group
fields:
- name: bf_aborts
type: long
description: |
Total number of local transactions that were aborted by slave transactions while in execution.
- name: cert_failures
type: long
description: |
Total number of local transactions that failed certification test.
- name: commits
type: long
description: |
Total number of local transactions committed.
- name: recv
type: group
fields:
- name: queue
type: long
description: |
Current (instantaneous) length of the recv queue.
- name: queue_avg
type: double
description: |
Recv queue length averaged over interval since the last FLUSH STATUS command. Values considerably larger than 0.0 mean that the node cannot apply write-sets as fast as they are received and will generate a lot of replication throttling.
- name: queue_max
type: long
description: |
The maximum length of the recv queue since the last FLUSH STATUS command.
- name: queue_min
type: long
description: |
The minimum length of the recv queue since the last FLUSH STATUS command.
- name: replays
type: long
description: |
Total number of transaction replays due to asymmetric lock granularity.
- name: send
type: group
fields:
- name: queue
type: long
description: |
Current (instantaneous) length of the send queue.
- name: queue_avg
type: double
description: |
Send queue length averaged over time since the last FLUSH STATUS command. Values considerably larger than 0.0 indicate replication throttling or network throughput issue.
- name: queue_max
type: long
description: |
The maximum length of the send queue since the last FLUSH STATUS command.
- name: queue_min
type: long
description: |
The minimum length of the send queue since the last FLUSH STATUS command.
- name: state
type: keyword
description: |
Internal Galera Cluster FSM state number.
- name: ready
type: keyword
description: |
Whether the server is ready to accept queries.
- name: received
type: group
fields:
- name: count
type: long
description: |
Total number of write-sets received from other nodes.
- name: bytes
type: long
description: |
Total size of write-sets received from other nodes.
- name: repl
type: group
fields:
- name: data_bytes
type: long
description: |
Total size of data replicated.
- name: keys
type: long
description: |
Total number of keys replicated.
- name: keys_bytes
type: long
description: |
Total size of keys replicated.
- name: other_bytes
type: long
description: |
Total size of other bits replicated.
- name: count
type: long
description: |
Total number of write-sets replicated (sent to other nodes).
- name: bytes
type: long
description: |
Total size of write-sets replicated.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: mysql
type: group
22 changes: 22 additions & 0 deletions dev/packages/alpha/mysql-0.0.2/dataset/galera_status/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
title: MySQL galera_status metrics
release: beta
type: metrics
streams:
- input: mysql/metrics
enabled: false
vars:
- name: period
type: text
title: Period
required: true
show_user: true
default: 10s
- name: raw
type: bool
title: Raw
description: >
When enabled, in addition to the existing data structure, all fields available from the mysql service through
"SHOW /*!50002 GLOBAL */ STATUS;" will be added to the event.
default: false
title: MySQL galera_status metrics
description: Collect MySQL galera_status metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
input: log
paths:
{{#each paths}}
- {{this}}
{{/each}}
exclude_files: ['.gz$']
multiline:
pattern: '^(# User@Host: |# Time: )'
negate: true
match: after
exclude_lines: ['^[\/\w\.]+, Version: .* started with:.*', '^# Time:.*'] # Exclude the header and time
Loading