← Back to team overview

maria-developers team mailing list archive

Re: MDEV-4472 (audit plugin)


Hi, Alexey!

On Jun 25, Alexey Botchkov wrote:
> Modified version of the file is in the same place:


> >> What's missing in it as i'm not sure how it can be done:
> >>       - No server host/ip in the log. How get that information?
> >
> > What server host/ip?
> I mean i don't know about the server's host/ip. The clien't one can be 
> found in the event as i understand.

Yes. But surely, you can find your own host/ip, cannot you?
See gethostname(), getaddrinfo(), etc.

> Works faster than the mysys/HASH invocation and not that much more lines 
> of code. But ok - redone with the server's HASH.


> line 248:
> > static int write_log(const char *message, size_t len)
> > {
> >   if (output_type == OUTPUT_FILE)
> >     return logger_write(logfile, message, len);
> >   return 0;
> > }
> > // better extend the logger service to support syslog
> I don't think so. The logger service is naturally oriented on files with 
> all these rotations and filesizes. And the SYSLOG interface is also 
> pretty simple and natural for it's purpose. So i really don't like 
> mixing these in one service.

My thought was that to log whatever is needed, a plugin opens and
configures a logger, and that's pretty much all it needs to do.

Having a purely file-oriented logger, every plugin that wants syslog,
would need to copy what you've done here, in this plugin.

While having one logger that understands many destinations, would
automatically make all plugins syslog-enabled.

On the other hand, logging to syslog often means using a different
logging format, which means plugins won't necessarily be automatically
"syslog enabled".

Ok, let's keep syslog separate for now. When we'll have more logs
that go to syslog, we'll see if it makes sense to factor the common
code out.

> >   fprintf(stderr, "STARTED\n");
> > // really? I thought you need to log it in the log
> > // preferrably with the plugin version, and may be the server version
> >    too
> Spec states that we should report that events to the main server log.
> And it seems right to me. The logging in the plugin isn't necessarily 
> enabled here, and we know for sure that the plugin is enabled if
> we see records from it in it's log.



Follow ups