Re: [Dnsmasq-discuss] Log to database

2016-06-14 Thread Sergey Nechaev
Hello, 

Logging to a pipe is dangerous, because if no one reads from pipe write system 
call will block after internal kernel buffer is full.
If write is not non-blocking and  is not wrapped into 
poll/select/epoll/whatever else (Normally, log calls are blocking), the whole 
dnsmasq process will stuck.

You can rotate log files more often and process log file after rotation. 
 

-- 
With best regards, 
Sergey Nechaev
> 13 июня 2016 г., в 22:42, Joachim Zobel  написал(а):
> 
> Oooops, logging to a pipe is not supported. Got the point ...
> 
> Sincerely,
> Joachim
> 
> ___
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss



smime.p7s
Description: S/MIME cryptographic signature
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Log to database

2016-06-13 Thread Joachim Zobel

Oooops, logging to a pipe is not supported. Got the point ...

Sincerely,
Joachim

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Log to database

2016-06-13 Thread Joachim Zobel


On 13.06.2016 18:04, Eric Hiller wrote:


"This paper describes an approach with rsyslogd, an alternative 
enhanced syslog daemon natively supporting MySQL and PostgreSQL. "


http://www.rsyslog.com/doc/v8-stable/tutorials/database.html


Hi.

Unfortunately this does not fit my needs. Since my main target platform 
are routers I am looking for a zero dependency solution. An alternative 
syslogd is not an option.


I think it should be possible to log to a named pipe and to have a 
script that is parsing everything from the pipe into db inserts. If 
nobody has done that yet I'll have to try it myself.


Thanks,
Joachim


___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Log to database

2016-06-13 Thread Eric Hiller
Depending upon your distro, you may be running rsyslogd anyways. Debian
defaults to it at least, I think red hats do too, but I am not sure on that.

-Eric

On Mon, Jun 13, 2016 at 11:37 AM Joachim Zobel 
wrote:

>
> On 13.06.2016 18:04, Eric Hiller wrote:
> >
> > "This paper describes an approach with rsyslogd, an alternative
> > enhanced syslog daemon natively supporting MySQL and PostgreSQL. "
> >
> > http://www.rsyslog.com/doc/v8-stable/tutorials/database.html
> >
> Hi.
>
> Unfortunately this does not fit my needs. Since my main target platform
> are routers I am looking for a zero dependency solution. An alternative
> syslogd is not an option.
>
> I think it should be possible to log to a named pipe and to have a
> script that is parsing everything from the pipe into db inserts. If
> nobody has done that yet I'll have to try it myself.
>
> Thanks,
> Joachim
>
> --
*Eric D Hiller | *www*.hiller.pro *
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Log to database

2016-06-13 Thread Eric Hiller
Albert,

That is a great idea! I used to do just this, worked wonders. Joachim,
see the tutorial:
"This paper describes an approach with rsyslogd, an alternative enhanced
syslog daemon natively supporting MySQL and PostgreSQL. "

http://www.rsyslog.com/doc/v8-stable/tutorials/database.html
Hi Joachim,

Le Sun, 12 Jun 2016 17:39:12 +0200
Joachim Zobel  a écrit:

> Hi.
>
> The main problem for my reverse_replace script is speed. It takes a
> minute, which is too slow to be run from a web gui. This is because
> the script parses the last 15k lines and puts them into an IP->name
> lookup tables made up from enviroment variables.
>
> Is there a way to log queries to a database? Something along the
> lines of log-facility=/named/pipe and a clever script that turns its
> stdin into INSERT statements. This way I could avoid building the
> lookup table.

I don"t see any option in dnsmasq for that, but maybe you could
configure your syslog/rsyslog/systemd logger to route dnsmasq logs to
some script (in addition to the standard logging), and that script
would do the database logging.

Problem, of course, is that you'd have to handle database purging, as I
don't think dnsmasq anything when it purges its cache, so your DB would
keep growing if you did not purge it, e.g. based on record date.

> Sincerely,
> Joachim

Amicalement,
--
Albert.

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Log to database

2016-06-13 Thread Albert ARIBAUD
Hi Joachim,

Le Sun, 12 Jun 2016 17:39:12 +0200
Joachim Zobel  a écrit:

> Hi.
> 
> The main problem for my reverse_replace script is speed. It takes a 
> minute, which is too slow to be run from a web gui. This is because
> the script parses the last 15k lines and puts them into an IP->name
> lookup tables made up from enviroment variables.
> 
> Is there a way to log queries to a database? Something along the
> lines of log-facility=/named/pipe and a clever script that turns its
> stdin into INSERT statements. This way I could avoid building the
> lookup table.

I don"t see any option in dnsmasq for that, but maybe you could
configure your syslog/rsyslog/systemd logger to route dnsmasq logs to
some script (in addition to the standard logging), and that script
would do the database logging.

Problem, of course, is that you'd have to handle database purging, as I
don't think dnsmasq anything when it purges its cache, so your DB would
keep growing if you did not purge it, e.g. based on record date.

> Sincerely,
> Joachim

Amicalement,
-- 
Albert.

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


[Dnsmasq-discuss] Log to database

2016-06-12 Thread Joachim Zobel

Hi.

The main problem for my reverse_replace script is speed. It takes a 
minute, which is too slow to be run from a web gui. This is because the 
script parses the last 15k lines and puts them into an IP->name lookup 
tables made up from enviroment variables.


Is there a way to log queries to a database? Something along the lines 
of log-facility=/named/pipe and a clever script that turns its stdin 
into INSERT statements. This way I could avoid building the lookup table.


Sincerely,
Joachim


___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss