Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 502972 - www-servers/varnish - /etc/conf.d/varnishd should set logformat definition
Summary: www-servers/varnish - /etc/conf.d/varnishd should set logformat definition
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2014-02-27 13:53 UTC by Bertrand Jacquin
Modified: 2014-03-02 18:41 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
conf.d & init.d patch (varnish-logformat.diff,2.71 KB, patch)
2014-02-27 13:56 UTC, Bertrand Jacquin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bertrand Jacquin 2014-02-27 13:53:13 UTC
On current stable www-servers/varnish ebuild, you cannot define your own logformat using the -F option to VARNISHNCSA_ARGS.

For exemple, if you want to define the following LogFormat :

  %h %{X-Forwarded-For}i %{Host}i %u %t %{Varnish:handling}x %{Varnish:hitmiss}x %s %b "%m %U%q %H"

Then you define

  VARNISHNCSA_ARGS="-a -w /var/log/varnish/access.log -F '%h %{X-Forwarded-For}i %{Host}i %u %t %{Varnish:handling}x %{Varnish:hitmiss}x %s %b "%m %U%q %H"'"

Restart varnish, you get the following :

  # /etc/init.d/varnishd
   * Caching service dependencies ...
  /etc/init.d/../conf.d/varnishd: line 11: fg: no job control                                                                                                                                         [ ok
  /etc/init.d/../conf.d/varnishd: line 11: fg: no job control
   * Stopping varnish ...                                                                                                                                                                             [ ok
   * Stopping varnish logging ...                                                                                                                                                                     [ ok
  /etc/init.d/../conf.d/varnishd: line 11: fg: no job control
   * Starting varnish ...           

And varnishncsa is not started

If you define use double quotes over -F :

  VARNISHNCSA_ARGS="-a -w /var/log/varnish/access.log -F \"%h %{X-Forwarded-For}i %{Host}i %u %t %{Varnish:handling}x %{Varnish:hitmiss}x %s %b '%m %U%q %H'\""

Then it start correctly, but you get the following logs :

"10.90.69.66
"10.90.69.66
"10.90.69.66
"10.90.69.66

# tr '\0' ';' < /proc/29819/cmdline ; echo
/usr/bin/varnishncsa;-D;-P;/var/run/varnishncsa.pid;-a;-w;/var/log/varnish/access.log;-F;"%h;%{X-Forwarded-For}i;%{Host}i;%u;%t;%{Varnish:handling}x;%{Varnish:hitmiss}x;%s;%b;'%m;%U%q;%H'";

Here, each argument to -F is a different ARGV, while the whole LogFormat should be a single ARGV.

The current situation happend because in /etc/init.d/varnishd ${VARNISHNCSA_ARGS} is use unquoted, but it should not be.

Here is a patch that add a variable to conf.d, VARNISHNCSA_LOGFORMAT that permit us to override this madness.

The patch also replace /var/run with /run and wrap lines

Reproducible: Always
Comment 1 Bertrand Jacquin 2014-02-27 13:56:50 UTC
Created attachment 371396 [details, diff]
conf.d & init.d patch
Comment 2 Anthony Basile gentoo-dev 2014-03-01 19:53:59 UTC
This is in the tree with varnish-3.0.5-r4.  Please test and if there's anything wrong, please reopen this bug.
Comment 3 Bertrand Jacquin 2014-03-02 14:04:04 UTC
(In reply to Anthony Basile from comment #2)
> This is in the tree with varnish-3.0.5-r4.  Please test and if there's
> anything wrong, please reopen this bug.

Everything OK for me.

Thanks
Comment 4 Bertrand Jacquin 2014-03-02 14:30:44 UTC
(In reply to Bertrand Jacquin from comment #3)
> (In reply to Anthony Basile from comment #2)
> > This is in the tree with varnish-3.0.5-r4.  Please test and if there's
> > anything wrong, please reopen this bug.
> 
> Everything OK for me.
> 
> Thanks

Except that Manifest is not complete.
Comment 5 Anthony Basile gentoo-dev 2014-03-02 15:37:56 UTC
(In reply to Bertrand Jacquin from comment #4)
> (In reply to Bertrand Jacquin from comment #3)
> > (In reply to Anthony Basile from comment #2)
> > > This is in the tree with varnish-3.0.5-r4.  Please test and if there's
> > > anything wrong, please reopen this bug.
> > 
> > Everything OK for me.
> > 
> > Thanks
> 
> Except that Manifest is not complete.

Please explain.  I just check the manifest here and its fine.
Comment 6 Bertrand Jacquin 2014-03-02 15:49:23 UTC
(In reply to Anthony Basile from comment #5)
> (In reply to Bertrand Jacquin from comment #4)
> > (In reply to Bertrand Jacquin from comment #3)
> > > (In reply to Anthony Basile from comment #2)
> > > > This is in the tree with varnish-3.0.5-r4.  Please test and if there's
> > > > anything wrong, please reopen this bug.
> > > 
> > > Everything OK for me.
> > > 
> > > Thanks
> > 
> > Except that Manifest is not complete.
> 
> Please explain.  I just check the manifest here and its fine.

!!! A file listed in the Manifest could not be found: /usr/portage/www-servers/varnish/files/varnishd.initd-r2.orig
Comment 7 Anthony Basile gentoo-dev 2014-03-02 18:41:10 UTC
(In reply to Bertrand Jacquin from comment #6)
> (In reply to Anthony Basile from comment #5)
> > (In reply to Bertrand Jacquin from comment #4)
> > > (In reply to Bertrand Jacquin from comment #3)
> > > > (In reply to Anthony Basile from comment #2)
> > > > > This is in the tree with varnish-3.0.5-r4.  Please test and if there's
> > > > > anything wrong, please reopen this bug.
> > > > 
> > > > Everything OK for me.
> > > > 
> > > > Thanks
> > > 
> > > Except that Manifest is not complete.
> > 
> > Please explain.  I just check the manifest here and its fine.
> 
> !!! A file listed in the Manifest could not be found:
> /usr/portage/www-servers/varnish/files/varnishd.initd-r2.orig

Yeah something strange happened because I didn't have that at my end.  I always use repoman that's supposed to catch violations like this.  Anyhow, I recommitted the Manifest.  Let me know if it continues.