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

add mariadb module for filebeat #7422

Closed
wants to merge 4 commits into from

Conversation

rdglinux
Copy link
Contributor

Added filebeat module to mariadb logs.

Module created based on discuss: https://discuss.elastic.co/t/filebeat-mysql-module-slowlog-error-message-provided-grok-expressions-do-not-match-field-value/135945/3

Logging pattern to be parsed:

# Time: 180613 11:04:36
# User@Host: root[root] @ localhost [ ]
# Thread_id: 5  Schema:   QC_hit: No
# Query_time: 2.000652  Lock_time: 0.000000  Rows_sent: 1  Rows_examined: 0
SET timestamp=1528898676;
select sleep(2);

To do:

Adjust and create dashboard file do Kibana

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@karmi
Copy link

karmi commented Jun 26, 2018

Hi @rdglinux, we have found your signature in our records, but it seems like you have signed with a different e-mail than the one used in yout Git commit. Can you please add both of these e-mails into your Github profile (they can be hidden), so we can match your e-mails to your Github profile?

@jsoriano
Copy link
Member

@rdglinux thanks for this! You will need to run make update inside filebeat and commit the changes.

@ruflin
Copy link
Contributor

ruflin commented Jun 27, 2018

Could you also add a small test log file to verify the changes (see other filesets). PR will also need a changelog entry.

@rdglinux
Copy link
Contributor Author

@karmi thanks for your reply...i updated my other e-mail in my github.

@karmi
Copy link

karmi commented Jul 1, 2018

@rdglinux , great!, the CLA check is green now.

rdglinux added 2 commits July 1, 2018 09:20
update field name from mariadb.slowlog.query_time.sec to mariadb.slowlog.query_time.sec
@ruflin
Copy link
Contributor

ruflin commented Jul 2, 2018

@rdglinux Something seems to be still off with the generated files. Could you rebase on master and run again make update ?

@ceesvanegmond
Copy link

Cool new feature! Will it get merged?

@ceesvanegmond
Copy link

Fix works on my machine!

@jsoriano
Copy link
Member

@rdglinux are you planning to continue with this PR? if you cannot do it we could try to finish and merge it. It'd be great in any case if you could add some example log file for testing. Thanks!

@rdglinux
Copy link
Contributor Author

Hi @jsoriano!

Sorry for my late reply, i was involved in other projects.

I used this module for my database MariaDB and works good. So i belive we could merge it.

Fallow my log!.

image

@NoSkillGuy
Copy link

NoSkillGuy commented Oct 4, 2018

Hi @rdglinux

My MariaDB slow log format is slightly different.

# Time: 181004 10:53:53
# User@Host: user_name[current_user_name] @  [ip]
# Thread_id: 25844  Schema: blah  QC_hit: No
# Query_time: 178.306017  Lock_time: 0.000000  Rows_sent: 0  Rows_examined: 53022772
# Rows_affected: 3062
# Full_scan: Yes  Full_join: No  Tmp_table: Yes  Tmp_table_on_disk: No
# Filesort: Yes  Filesort_on_disk: No  Merge_passes: 0  Priority_queue: No
SET timestamp=1538650433;
call PROC('blah');

Version Details:
mysql Ver 15.1 Distrib 10.2.12-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

@NoSkillGuy
Copy link

NoSkillGuy commented Oct 4, 2018

Hi @rdglinux, For the above format I had written a new grok pattern

"^#%{SPACE}Time:%{SPACE}%{NUMBER:microseconds}%{SPACE}%{NUMBER:hours}:%{NUMBER:minutes}:%{NUMBER:seconds}\n#%{SPACE}User@Host:%{SPACE}%{USER:mysql.slowlog.user}\\[%{USER:current_user}\\]%{SPACE}@%{SPACE}\\[%{IP:mysql.slowlog.ip}\\]\n#%{SPACE}Thread_id:%{SPACE}%{NUMBER:thread_id}%{SPACE}Schema:%{SPACE}%{WORD:schema}%{SPACE}QC_hit:%{SPACE}%{WORD:qc_hit}\n#%{SPACE}Query_time:%{SPACE}%{NUMBER:mysql.slowlog.query_time.sec}%{SPACE}Lock_time:%{SPACE}%{NUMBER:mysql.slowlog.lock_time.sec}%{SPACE}Rows_sent:%{SPACE}%{NUMBER:mysql.slowlog.rows_sent}%{SPACE}Rows_examined:%{SPACE}%{NUMBER:mysql.slowlog.rows_examined}\n#%{SPACE}Rows_affected:%{SPACE}%{NUMBER:rows_affected}\n#%{SPACE}Full_scan:%{SPACE}%{WORD:full_scan}%{SPACE}Full_join:%{SPACE}%{WORD:full_join}%{SPACE}Tmp_table:%{SPACE}%{WORD:tmp_table}%{SPACE}Tmp_table_on_disk:%{SPACE}%{WORD:tmp_table_on_disk}\n#%{SPACE}Filesort:%{SPACE}%{WORD:filesort}%{SPACE}Filesort_on_disk:%{SPACE}%{WORD:filesort_on_disk}%{SPACE}Merge_passes:%{SPACE}%{NUMBER:merge_passes}%{SPACE}Priority_queue:%{SPACE}%{WORD:priority_queue}\nSET%{SPACE}timestamp=%{NUMBER:mysql.slowlog.timestamp};\n%{GREEDYMULTILINE:mysql.slowlog.query}"

@jsoriano
Copy link
Member

@rdglinux sorry also for my late reply 🙁

This is looking good to me, could you try to add some example test files? It'd be good if this works also with @NoSkillGuy's example.

@SPR0STO
Copy link

SPR0STO commented Dec 18, 2018

Hi @rdglinux and @jsoriano
When can we expect new functionality in production?

@jsoriano jsoriano added the Team:Integrations Label for the Integrations team label Dec 19, 2018
@jsoriano jsoriano self-assigned this Dec 20, 2018
@jsoriano
Copy link
Member

MariaDB support added at the end in the mysql module itself (#9731), thanks for the work and example cases here!
I will try to backport this for 6.7.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants