Web lists-archives.com

Re: server-side logging of query errors?




Further more, use logstash to collect the audit events and you can filter
out anything that wasn't an error and move it to a query error log.

On Wed, Jun 24, 2015 at 5:32 PM, Singer Wang <wang@xxxxxxxxxxxxxx> wrote:

> Yep, as shown below:
>
> root@audit-db.ec2:(none)> select fark from fark from fark fark fark from
> frak;
> ERROR 1064 (42000): You have an error in your SQL syntax; check the manual
> that corresponds to your MySQL server version for the right syntax to use
> near 'from fark fark fark from frak' at line 1
> root@audit-db.ec2:(none)>
>
> Jun 24 16:29:52 audit-db percona-audit:
>
> {"audit_record":{"name":"Query","record":"217_2015-06-24T16:29:52","timestamp":"2015-06-24T16:29:52
>
> UTC","command_class":"error","connection_id":"59","status":1064,"sqltext":"select
> fark from fark from fark fark fark from frak","user":"root[root] @
> localhost []","host":"localhost","os_user":"","ip":""}}
>
> error 1064
>
>
> On Wed, Jun 24, 2015 at 11:40 AM, Tomasz Chmielewski <mangoo@xxxxxxxx>
> wrote:
>
> > Normal general log also logs everything including bad queries (i.e.
> SLCECT
> > BLAH BLAH;) - although does not say if it was an error (i.e. syntax) or
> not.
> >
> > Does the audit plugin log the actual error?
> >
> >
> > Tomasz
> >
> > On 2015-06-25 00:32, Singer Wang wrote:
> >
> >> The performance hit of the Percona Audit is 15% for disk logging and
> >> for remote syslog we found it is lower. It logs everything including
> >> bad queries (eg. select fark from fark from fark fark fark from frak).
> >> You should be able to write a JSON parser that extracts what you want
> >> based on the log (eg. STATUS, COMMAND, NAME).
> >>
> >> On Wed, Jun 24, 2015 at 11:05 AM, Johan De Meersman
> >> <vegivamp@xxxxxxxxx> wrote:
> >>
> >>  -------------------------
> >>>
> >>>  FROM: "Singer X.J. Wang" <wang@xxxxxxxxxxxxxx>
> >>>> SUBJECT: Re: server-side logging of query errors?
> >>>>
> >>>
> >>>  You could log all queries using the audit plugin, 15% hit..
> >>>>
> >>> Fair point, though: maybe one of the different audit plugins has
> >>> the capability to specifically log faulty requests. Have a look
> >>> through the slides from Percona Live London 2014, there was a talk
> >>> about auditing.
> >>>
> >>> --
> >>>
> >>> Unhappiness is discouraged and will be corrected with kitten
> >>> pictures.
> >>>
> >>
> >
>