1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999
|
'\" t
.\" Title: \fBmysqlauditgrep\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 08/30/2013
.\" Manual: MySQL Utilities
.\" Source: MySQL 1.3.4
.\" Language: English
.\"
.TH "\FBMYSQLAUDITGREP\FR" "1" "08/30/2013" "MySQL 1\&.3\&.4" "MySQL Utilities"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.\" mysqlauditgrep
.\" utilities: mysqlauditgrep
.\" scripts
.SH "NAME"
mysqlauditgrep \- Search an audit log
.SH "SYNOPSIS"
.\".HP \w'\fB\ mysqlauditgrep\ [\fR\fB\fIOPTIONS\fR\fR\fB]\&.\&.\&.\ \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB\ \fR\fB\ mysqlauditgrep\ \-\-file\-stats[\-\-format=\fR\fB\fIFORMAT\fR\fR\fB]\ \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB\ \fR\fB\ mysqlauditgrep\ \-\-format=\fR\fB\fIFORMAT\fR\fR\fB\ \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB\ \fR\fB\ mysqlauditgrep\ [\-\-users=\fR\fB\fIUSERS\fR\fR\fB]\ [\-\-start\-date=\fR\fB\fISTART_DATE\fR\fR\fB]\ [\-\-end\-date=\fR\fB\fIEND_DATE\fR\fR\fB]\ [\-\-pattern=\fR\fB\fIPATTERN\fR\fR\fB[\-\-regexp]]\ [\-\-query\-type=\fR\fB\fIQUERY_TYPE\fR\fR\fB]\ [\-\-event\-type=\fR\fB\fIEVENT_TYPE\fR\fR\fB]\ [\-\-status=\fR\fB\fISTATUS\fR\fR\fB]\ [\-\-format=\fR\fB\fIFORMAT\fR\fR\fB]\ \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB\ \fR\ 'u
\fB mysqlauditgrep [\fR\fB\fIOPTIONS\fR\fR\fB]\&.\&.\&. \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB \fR
\fB mysqlauditgrep \-\-file\-stats[\-\-format=\fR\fB\fIFORMAT\fR\fR\fB] \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB \fR
\fB mysqlauditgrep \-\-format=\fR\fB\fIFORMAT\fR\fR\fB \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB \fR
\fB mysqlauditgrep [\-\-users=\fR\fB\fIUSERS\fR\fR\fB] [\-\-start\-date=\fR\fB\fISTART_DATE\fR\fR\fB] [\-\-end\-date=\fR\fB\fIEND_DATE\fR\fR\fB] [\-\-pattern=\fR\fB\fIPATTERN\fR\fR\fB[\-\-regexp]] [\-\-query\-type=\fR\fB\fIQUERY_TYPE\fR\fR\fB] [\-\-event\-type=\fR\fB\fIEVENT_TYPE\fR\fR\fB] [\-\-status=\fR\fB\fISTATUS\fR\fR\fB] [\-\-format=\fR\fB\fIFORMAT\fR\fR\fB] \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB \fR
.SH "DESCRIPTION"
.PP
This utility allows you to search the current or archived audit logs, allowing you to display data from the audit log file according to the defined search criterion\&. It also allows you to output the results in different formats, namely GRID (default), TAB, CSV, VERTICAL, and RAW (the original XML format)\&.
.PP
This utility allows you to search and filter the returned audit log records by: users (\fB\-\-users\fR), date and time ranges (\fB\-\-start\-date\fR
and
\fB\-\-end\-date\fR), SQL query types (\fB\-\-query\-type\fR), logged event and record types (\fB\-\-event\-type\fR), status (\fB\-\-status\fR), and matching patterns (\fB\-\-pattern\fR)\&. Any of these search options can be combined and used together, with the retrieved records resulting from all passed in options being true\&.
.PP
The
\fB\-\-pattern\fR
supports two types of pattern matching: standard SQL, used with the SQL
\fILIKE\fR
operator (SQL patterns), and standard
\fIREGEXP\fR
(POSIX regular expression patterns)\&.
.PP
This utility always requires an audit log file to be passed in, so the
\fIAUDIT_LOG_FILE\fR
argument is searched as a full path and file name for the audit log file\&. If not specified, a notification concerning this requirement will be printed\&. And if
\fB\-\-format\fR
is passed in without search parameters, then all the records of the audit log are displayed in the specified format\&.
.PP
The
\fB\-\-file\-stats\fR
option is not considered a search criteria, and is used to display the file statistics of a specified audit log\&. Other search options will be ignored when the
\fB\-\-file\-stats\fR
option is used, except the
\fB\-\-format\fR
option will continue to format the results accordingly\&.
.PP
To specify the format of the generated results, use one of the following values with the
\fB\-\-format\fR
option:
.sp
.RS 4
.ie n \{\
\h'-04' 1.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 1." 4.2
.\}
\fIGRID (default)\fR
.sp
Display output in grid or table format like that of the
\fBmysql\fR
monitor\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 2.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 2." 4.2
.\}
\fICSV\fR
.sp
Display output in comma\-separated values format\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 3.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 3." 4.2
.\}
\fIVERTICAL\fR
.sp
Display output in single\-column format like that of the
\eG
command for the
\fBmysql\fR
monitor\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 4.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 4." 4.2
.\}
\fIRAW\fR
.sp
Display output results in the original raw format of the audit log records, which is written in XML\&.
.RE
Standard SQL Pattern Matching
.PP
The simple patterns defined by the SQL standard enables users to use two characters with special meanings:
\(lq%\(rq
(percent) matches zero or more characters, and
\(lq_\(rq
(underscore) matches exactly one arbitrary character\&. In standard SQL, these types of patterns are used with the
LIKE
comparison operator, and they are case\-insensitive by default\&. This utility assumes that they are case\-insensitive\&.
.PP
For example:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
"audit%"
.sp
Match any string that starts with "audit"\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
"%log%"
.sp
Match any string containing the word "log"\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
"%_"
.sp
Match any string consisting of one or more characters\&.
.RE
.PP
For documentation about the standard SQL pattern matching syntax, see
\m[blue]\fBPattern Matching\fR\m[]\&\s-2\u[1]\d\s+2\&.
REGEXP Pattern Matching (POSIX)
.PP
Standard
\fIREGEXP\fR
patterns are more powerful than the simple patterns defined in the SQL standard\&. A regular expression is a string of ordinary and special characters specified to match other strings\&. Unlike SQL Patterns,
\fIREGEXP\fR
patterns are case\-sensitive\&. The
\fIREGEXP\fR
syntax defines the following characters with special meaning:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI\&.\fR
.sp
Match any character\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI^\fR
.sp
Match the beginning of a string\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI$\fR
.sp
Match the end of a string\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI\e\fR
.sp
Match zero or more repetitions of the preceding regular expression\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI+\fR
.sp
Match one or more repetitions of the preceding regular expression\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI?\fR
.sp
Match zero or one repetition of the preceding regular expression\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI|\fR
.sp
Match either the regular expressions from the left or right of
|\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI[]\fR
.sp
Indicates a set of characters to match\&. Note that, special characters lose their special meaning inside sets\&. In particular,
^
acquires a different meaning if it is the first character of the set, matching the complementary set (i\&.e\&., all the characters that are not in the set will be matched)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI{m}\fR
.sp
Match
\fIm\fR
repetitions of the preceding regular expression\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI{m,n}\fR
.sp
Match from
\fIm\fR
to
\fIn\fR
repetitions of the preceding regular expression\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI()\fR
.sp
Define a matching group, and matches the regular expression inside the parentheses\&.
.RE
.PP
For example:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI"a\e*"\fR
.sp
Match a sequence of zero or more
a\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI"a+"\fR
.sp
Match a sequence of one or more
a\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI"a?"\fR
.sp
Match zero or one
a\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI"ab|cd"\fR
.sp
Match
ab
or
cd\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI"[axy]"\fR
.sp
Match
a,
x
or
y\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI"[a\-f]"\fR
.sp
Match any character in the range
a
to
f
(that is,
a,
b,
c,
d,
e, or
f)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI"[^axy]"\fR
.sp
Match any character
\fIexcept\fRa,
x
or
y\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI"a{5}"\fR
.sp
Match exactly five copies of
a\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI"a{2,5}"\fR
.sp
Match from two to five copies of
a\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI"(abc)+"\fR
.sp
Match one or more repetitions of
abc\&.
.RE
.PP
This is a brief overview of regular expressions that can be used to define this type of patterns\&. The full syntax is described in the
\m[blue]\fBPython "re" module docs\fR\m[]\&\s-2\u[2]\d\s+2, supporting the definition of much more complex pattern matching expression\&.
OPTIONS
.PP
\fBmysqlauditgrep\fR
accepts the following command\-line options:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-end\-date=<END_DATE>
.sp
End date/time to retrieve log entries until the specified date/time range\&. If not specified or the value is 0, all entries to the end of the log are displayed\&. Accepted formats: "yyyy\-mm\-ddThh:mm:ss" or "yyyy\-mm\-dd"\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-event\-type=<EVENT_TYPE>
.sp
Comma\-separated list of event types to search in all audit log records matching the specified types\&. Supported values are: Audit, Binlog Dump, Change user, Close stmt, Connect Out, Connect, Create DB, Daemon, Debug, Delayed insert, Drop DB, Execute, Fetch, Field List, Init DB, Kill, Long Data, NoAudit, Ping, Prepare, Processlist, Query, Quit, Refresh, Register Slave, Reset stmt, Set option, Shutdown, Sleep, Statistics, Table Dump, Time\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-file\-stats
.sp
Display the audit log file statistics\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-format=FORMAT, \-f FORMAT
.sp
Output format to display the resulting data\&. Supported format values: GRID (default), TAB, CSV, VERTICAL and RAW\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-help
.sp
Display a help message and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-pattern=<PATTERN>, \-e <PATTERN>
.sp
Search pattern to retrieve all entries with at least one attribute value matching the specified pattern\&. By default the standard SQL
\fILIKE\fR
patterns are used for matching\&. If the
\fB\-\-regexp\fR
option is set, then
\fIREGEXP\fR
patterns must be specified for matching\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-query\-type=<QUERY_TYPE>
.sp
Comma\-separated list of SQL statements/commands to search for and match\&. Supported values: CREATE, ALTER, DROP, TRUNCATE, RENAME, GRANT, REVOKE, SELECT, INSERT, UPDATE, DELETE, COMMIT, SHOW, SET, CALL, PREPARE, EXECUTE, DEALLOCATE\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-regexp, \-\-basic\-regexp, \-G
.sp
Indicates that pattern matching will be performed using a regular expression
\fIREGEXP\fR
(from the Python re module)\&. By default, the simple standard SQL
\fILIKE\fR
patterns are used for matching\&. This affects how the value specified by the
\fB\-\-pattern\fR
option is interpreted\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-start\-date=<START_DATE>
.sp
Starting date/time to retrieve log entries from the specified date/time range\&. If not specified or the value is 0, all entries from the start of the log are displayed\&. Accepted formats: yyyy\-mm\-ddThh:mm:ss or yyyy\-mm\-dd\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-status=<STATUS>
.sp
Comma\-separated list of status values or intervals to search for all audit log records with a matching status\&. Status values are non\-negative integers (corresponding to MySQL error codes)\&. Status intervals are closed (i\&.e\&., include both endpoints) and defined simply using a dash between its endpoints\&. For Example: 1051,1068\-1075,1109,1146\&.
.sp
The
\-\-status
option is available as of MySQL Utilities 1\&.2\&.4 / 1\&.3\&.3\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-users=<USERS>, \-u <USERS>
.sp
Comma\-separated list of user names, to search for their associated log entries\&. For example: "dan,jon,john,paul,philip,stefan"\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-verbose, \-v
.sp
Specify how much information to display\&. Use this option multiple times to increase the amount of information\&. For example,
\fB\-v\fR
= verbose,
\fB\-vv\fR
= more verbose,
\fB\-vvv\fR
= debug\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-version
.sp
Display version information and exit\&.
.RE
NOTES
.PP
This utility is available as of μ 1\&.2\&.0\&.
.PP
This utility can only be applied to servers with the
\m[blue]\fBaudit log plugin enabled\fR\m[]\&\s-2\u[3]\d\s+2\&. And the audit log plugin is available as of MySQL Server versions 5\&.5\&.28 and 5\&.6\&.10\&.
.PP
This utility requires the use of Python version 2\&.6 or higher, but does not support Python 3\&.
.PP
Single or double quote characters (respectively,
\fI\*(Aq\fR
or
\fI"\fR) can be used around option values\&. In fact, quotes are required to set some options values correctly, such as values with whitespace\&. For example, to specify the event types
\fBCreate DB\fR
and
\fBDrop DB\fR
for the
\fB\-\-event\-type\fR
option, the following syntax must be used:
\fB\-\-event\-type=\*(AqCreate DB,Drop DB\*(Aq\fR
or
\fB\-\-event\-type="Create DB,Drop DB"\fR\&.
EXAMPLES
.PP
To display the audit log file statistics and output the results in CSV format, run the following command:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> mysqlauditgrep \-\-file\-stats \-\-format=CSV /SERVER/data/audit\&.log
#
# Audit Log File Statistics:
#
File,Size,Created,Last Modified
audit\&.log,9101,Thu Sep 27 13:33:11 2012,Thu Oct 11 17:40:35 2012
#
# Audit Log Startup Entries:
#
SERVER_ID,STARTUP_OPTIONS,NAME,TIMESTAMP,MYSQL_VERSION,OS_VERSION,VERSION
1,/SERVER/sql/mysqld \-\-defaults\-file=/SERVER/my\&.cnf,Audit,2012\-09\-27T13:33:11,5\&.5\&.29\-log,x86_64\-Linux,1
.fi
.if n \{\
.RE
.\}
.PP
To display the audit log entries of specific users, use the following command:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> mysqlauditgrep \-\-users=tester1,tester2 /SERVER/data/audit\&.log
.fi
.if n \{\
.RE
.\}
.PP
To display the audit log file statistics, run the following command:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> mysqlauditgrep \-\-users=tester1,tester2 /SERVER/data/audit\&.log
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| STATUS | SERVER_ID | NAME | TIMESTAMP | CONNECTION_ID | HOST | USER | PRIV_USER | IP | SQLTEXT |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| 0 | 1 | Connect | 2012\-09\-28T11:26:50 | 9 | localhost | root | tester1 | 127\&.0\&.0\&.1 | None |
| 0 | 1 | Query | 2012\-09\-28T11:26:50 | 9 | None | root | tester1 | None | SET @@session\&.autocommit = OFF |
| 0 | 1 | Ping | 2012\-09\-28T11:26:50 | 9 | None | root | tester1 | None | None |
| 0 | 1 | Query | 2012\-09\-28T11:26:50 | 9 | None | root | tester1 | None | SHOW VARIABLES LIKE \*(AqREAD_ONLY\*(Aq |
| 0 | 1 | Query | 2012\-09\-28T11:26:50 | 9 | None | root | tester1 | None | COMMIT |
| 0 | 1 | Ping | 2012\-09\-28T11:26:50 | 9 | None | root | tester1 | None | None |
| 0 | 1 | Query | 2012\-09\-28T11:26:50 | 9 | None | root | tester1 | None | COMMIT |
| 0 | 1 | Quit | 2012\-09\-28T11:26:50 | 9 | None | root | tester1 | None | None |
| 0 | 1 | Connect | 2012\-10\-10T15:55:55 | 11 | localhost | tester2 | root | 127\&.0\&.0\&.1 | None |
| 0 | 1 | Query | 2012\-10\-10T15:55:55 | 11 | None | tester2 | root | None | select @@version_comment limit 1 |
| 0 | 1 | Query | 2012\-10\-10T15:56:10 | 11 | None | tester2 | root | None | show databases |
| 1046 | 1 | Query | 2012\-10\-10T15:57:26 | 11 | None | tester2 | root | None | show tables test |
| 1046 | 1 | Query | 2012\-10\-10T15:57:36 | 11 | None | tester2 | root | None | show tables test |
| 0 | 1 | Query | 2012\-10\-10T15:57:51 | 11 | None | tester2 | root | None | show tables in test |
| 0 | 1 | Quit | 2012\-10\-10T15:57:59 | 11 | None | tester2 | root | None | None |
| 0 | 1 | Connect | 2012\-10\-10T17:35:42 | 12 | localhost | tester2 | root | 127\&.0\&.0\&.1 | None |
| 0 | 1 | Query | 2012\-10\-10T17:35:42 | 12 | None | tester2 | root | None | select @@version_comment limit 1 |
| 0 | 1 | Quit | 2012\-10\-10T17:47:22 | 12 | None | tester2 | root | None | None |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
.fi
.if n \{\
.RE
.\}
.PP
To display the audit log entries for a specific date/time range, use the following command:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> mysqlauditgrep \-\-start\-date=2012\-09\-27T13:33:47 \-\-end\-date=2012\-09\-28 /SERVER/data/audit\&.log
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| STATUS | TIMESTAMP | NAME | CONNECTION_ID | SQLTEXT |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| 0 | 2012\-09\-27T13:33:47 | Ping | 7 | None |
| 0 | 2012\-09\-27T13:33:47 | Query | 7 | SELECT * FROM INFORMATION_SCHEMA\&.PLUGINS WHERE PLUGIN_NAME LIKE \*(Aqaudit%\*(Aq |
| 0 | 2012\-09\-27T13:33:47 | Query | 7 | COMMIT |
| 0 | 2012\-09\-27T13:34:48 | Quit | 7 | None |
| 0 | 2012\-09\-27T13:34:48 | Quit | 8 | None |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
.fi
.if n \{\
.RE
.\}
.PP
To display the audit log entries matching a specific SQL
\fILIKE\fR
pattern, use the following command:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> mysqlauditgrep \-\-pattern="% = ___"; /SERVER/data/audit\&.log
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| STATUS | TIMESTAMP | NAME | SQLTEXT | CONNECTION_ID |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| 0 | 2012\-09\-27T13:33:39 | Query | SET @@session\&.autocommit = OFF | 7 |
| 0 | 2012\-09\-27T13:33:39 | Query | SET @@session\&.autocommit = OFF | 8 |
| 0 | 2012\-09\-28T11:26:50 | Query | SET @@session\&.autocommit = OFF | 9 |
| 0 | 2012\-09\-28T11:26:50 | Query | SET @@session\&.autocommit = OFF | 10 |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
.fi
.if n \{\
.RE
.\}
.PP
To display the audit log entries matching a specific
\fIREGEXP \fR
pattern, use the following command:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> mysqlauditgrep \-\-pattern="\&.* = \&.\&.\&." \-\-regexp /SERVER/data/audit\&.log
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| STATUS | TIMESTAMP | NAME | SQLTEXT | CONNECTION_ID |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| 0 | 2012\-09\-27T13:33:39 | Query | SET @@session\&.autocommit = OFF | 7 |
| 0 | 2012\-09\-27T13:33:39 | Query | SET @@session\&.autocommit = OFF | 8 |
| 0 | 2012\-09\-28T11:26:50 | Query | SET @@session\&.autocommit = OFF | 9 |
| 0 | 2012\-09\-28T11:26:50 | Query | SET @@session\&.autocommit = OFF | 10 |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
.fi
.if n \{\
.RE
.\}
.PP
To display the audit log entries of specific query types, use the following command:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> mysqlauditgrep \-\-query\-type=show,SET /SERVER/data/audit\&.log
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| STATUS | TIMESTAMP | NAME | SQLTEXT | CONNECTION_ID |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| 0 | 2012\-09\-27T13:33:39 | Query | SET NAMES \*(Aqlatin1\*(Aq COLLATE \*(Aqlatin1_swedish_ci\*(Aq | 7 |
| 0 | 2012\-09\-27T13:33:39 | Query | SET @@session\&.autocommit = OFF | 7 |
| 0 | 2012\-09\-27T13:33:39 | Query | SHOW VARIABLES LIKE \*(AqREAD_ONLY\*(Aq | 7 |
| 0 | 2012\-09\-27T13:33:39 | Query | SHOW VARIABLES LIKE \*(Aqdatadir\*(Aq | 7 |
| 0 | 2012\-09\-27T13:33:39 | Query | SHOW VARIABLES LIKE \*(Aqbasedir\*(Aq | 7 |
| 0 | 2012\-09\-27T13:33:39 | Query | SET NAMES \*(Aqlatin1\*(Aq COLLATE \*(Aqlatin1_swedish_ci\*(Aq | 8 |
| 0 | 2012\-09\-27T13:33:39 | Query | SET @@session\&.autocommit = OFF | 8 |
| 0 | 2012\-09\-27T13:33:39 | Query | SHOW VARIABLES LIKE \*(AqREAD_ONLY\*(Aq | 8 |
| 0 | 2012\-09\-27T13:33:39 | Query | SHOW VARIABLES LIKE \*(Aqbasedir\*(Aq | 8 |
| 0 | 2012\-09\-28T11:26:50 | Query | SET NAMES \*(Aqlatin1\*(Aq COLLATE \*(Aqlatin1_swedish_ci\*(Aq | 9 |
| 0 | 2012\-09\-28T11:26:50 | Query | SET @@session\&.autocommit = OFF | 9 |
| 0 | 2012\-09\-28T11:26:50 | Query | SHOW VARIABLES LIKE \*(AqREAD_ONLY\*(Aq | 9 |
| 0 | 2012\-09\-28T11:26:50 | Query | SET NAMES \*(Aqlatin1\*(Aq COLLATE \*(Aqlatin1_swedish_ci\*(Aq | 10 |
| 0 | 2012\-09\-28T11:26:50 | Query | SET @@session\&.autocommit = OFF | 10 |
| 0 | 2012\-09\-28T11:26:50 | Query | SHOW VARIABLES LIKE \*(AqREAD_ONLY\*(Aq | 10 |
| 0 | 2012\-09\-28T11:26:50 | Query | SET @@GLOBAL\&.audit_log_flush = ON | 10 |
| 0 | 2012\-09\-28T11:26:50 | Query | SHOW VARIABLES LIKE \*(Aqaudit_log_policy\*(Aq | 10 |
| 0 | 2012\-09\-28T11:26:50 | Query | SHOW VARIABLES LIKE \*(Aqaudit_log_rotate_on_size\*(Aq | 10 |
| 0 | 2012\-10\-10T15:56:10 | Query | show databases | 11 |
| 1046 | 2012\-10\-10T15:57:26 | Query | show tables test | 11 |
| 1046 | 2012\-10\-10T15:57:36 | Query | show tables test | 11 |
| 0 | 2012\-10\-10T15:57:51 | Query | show tables in test | 11 |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
.fi
.if n \{\
.RE
.\}
.PP
To display the audit log entries of specific event types, use the following command:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> mysqlauditgrep \-\-event\-type="Ping,Connect" /SERVER/data/audit\&.log
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+
| STATUS | NAME | TIMESTAMP | CONNECTION_ID | HOST | USER | PRIV_USER | IP |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+
| 0 | Connect | 2012\-09\-27T13:33:39 | 7 | localhost | root | root | 127\&.0\&.0\&.1 |
| 0 | Ping | 2012\-09\-27T13:33:39 | 7 | None | None | None | None |
| 0 | Ping | 2012\-09\-27T13:33:39 | 7 | None | None | None | None |
| 0 | Ping | 2012\-09\-27T13:33:39 | 7 | None | None | None | None |
| 0 | Ping | 2012\-09\-27T13:33:39 | 7 | None | None | None | None |
| 0 | Connect | 2012\-09\-27T13:33:39 | 8 | localhost | root | root | 127\&.0\&.0\&.1 |
| 0 | Ping | 2012\-09\-27T13:33:39 | 8 | None | None | None | None |
| 0 | Ping | 2012\-09\-27T13:33:39 | 8 | None | None | None | None |
| 0 | Ping | 2012\-09\-27T13:33:47 | 7 | None | None | None | None |
| 0 | Connect | 2012\-09\-28T11:26:50 | 9 | localhost | root | tester | 127\&.0\&.0\&.1 |
| 0 | Ping | 2012\-09\-28T11:26:50 | 9 | None | None | None | None |
| 0 | Ping | 2012\-09\-28T11:26:50 | 9 | None | None | None | None |
| 0 | Connect | 2012\-09\-28T11:26:50 | 10 | localhost | root | root | 127\&.0\&.0\&.1 |
| 0 | Ping | 2012\-09\-28T11:26:50 | 10 | None | None | None | None |
| 0 | Ping | 2012\-09\-28T11:26:50 | 10 | None | None | None | None |
| 0 | Ping | 2012\-09\-28T11:26:50 | 10 | None | None | None | None |
| 0 | Ping | 2012\-09\-28T11:26:50 | 10 | None | None | None | None |
| 0 | Ping | 2012\-09\-28T11:26:50 | 10 | None | None | None | None |
| 0 | Connect | 2012\-10\-10T15:55:55 | 11 | localhost | tester | root | 127\&.0\&.0\&.1 |
| 0 | Connect | 2012\-10\-10T17:35:42 | 12 | localhost | tester | root | 127\&.0\&.0\&.1 |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+
.fi
.if n \{\
.RE
.\}
.PP
To display the audit log entries with a specific status, use the following command:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> mysqlauditgrep \-\-status=1100\-1199,1046 /SERVER/data/audit\&.log
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| STATUS | TIMESTAMP | NAME | SQLTEXT | CONNECTION_ID |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| 1046 | 2012\-10\-10T15:57:26 | Query | show tables test | 11 |
| 1046 | 2012\-10\-10T15:57:36 | Query | show tables test | 11 |
| 1146 | 2012\-10\-10T17:44:55 | Query | select * from teste\&.employees where salary > 500 and salary < 1000 | 12 |
| 1046 | 2012\-10\-10T17:47:17 | Query | select * from test_encoding where value = \*(Aq<>"&\*(Aq | 12 |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
.fi
.if n \{\
.RE
.\}
.PP
Note: You can view all successful commands with
\fB\-\-status=0\fR
and all unsuccessful ones with
\fB\-\-status=1\-9999\fR\&.
.PP
To display the audit log entries matching several search criteria, use the following command:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> mysqlauditgrep \-\-users=root \-\-start\-date=0 \-\-end\-date=2012\-10\-10 \-\-event\-type=Query \e
\-\-query\-type=SET \-\-status=0 \-\-pattern="%audit_log%" /SERVER/data/audit\&.log
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| STATUS | SERVER_ID | NAME | TIMESTAMP | CONNECTION_ID | USER | PRIV_USER | SQLTEXT |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| 0 | 1 | Query | 2012\-09\-28T11:26:50 | 10 | root | root | SET @@GLOBAL\&.audit_log_flush = ON |
+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
.fi
.if n \{\
.RE
.\}
.SH "COPYRIGHT"
.br
.SH "NOTES"
.IP " 1." 4
Pattern Matching
.RS 4
\%http://dev.mysql.com/doc/refman/5.6/en/pattern-matching.html
.RE
.IP " 2." 4
Python "re" module docs
.RS 4
\%http://docs.python.org/2/library/re.html
.RE
.IP " 3." 4
audit log plugin enabled
.RS 4
\%http://dev.mysql.com/doc/refman/5.6/en/audit-log-plugin-installation.html
.RE
.SH "SEE ALSO"
For more information, please refer to the MySQL Utilities section
of the MySQL Workbench Reference Manual, which is available online
at http://dev.mysql.com/doc/workbench/en/.
.SH AUTHOR
Oracle Corporation (http://dev.mysql.com/).
|