← Back to team overview

maria-developers team mailing list archive

Re: MDEV-4472 (audit plugin)

 

Hi, Sergei.

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.

Right. So don't implement that, just use openlog/syslog/closelog.

done.


From the file:
line 169:
typedef struct server_audit_user_hash
{
  unsigned char table[0x10000];
  struct server_audit_user_rec userlist[USERLIST_SIZE_LIMIT];
  int n_users;
} SERVER_AUDIT_USER_HASH;
// why? why did you invent your own hash, while we have a perfectly
// usable hash in the server already?

I thought you'd going to like it :)
Technically i didn't invent anything - just implemented the common algorithm locally. 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.


line 490:
  servhost_len= strlen(servhost);
  error_header();
  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.

Best regards.
HF



On 06/22/2013 07:06 PM, Sergei Golubchik wrote:
Hi, Alexey!

On Jun 21, Alexey Botchkov wrote:
Hi, Sergei.

Here is the plugin code for you to check out.
It constists of a single new file, so i send you the link to it.
http://myoffice.izhnet.ru/~alex/server_audit/server_audit.c

See my review attached. Comments are marked by // at the start of the
line.

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?

      - SYSLOG logging.
            The SysLog i knew was declared in the syslog.h. That's the
interface talking to the
            local syslogd instance.
            If it's what we need to use, then i have no idea how to
specify the Syslog server IP for that
            daemon (which is required by the spec). I see nothing in the
API about it and i thought
            it should be configured with the daemon's cfg file or
something like that.

Right. So don't implement that, just use openlog/syslog/closelog.

Regards,
Sergei




Follow ups

References