W3C like format logging

Albert Tollkuçi albert.tollkuci at gmail.com
Fri May 27 10:43:50 CEST 2016


Thank you Per. I've tried various combinations, such ash:

ExecStart=/usr/bin/varnishncsa -a -w /var/log/varnish/varnishncsa.log -F
"%h"

ExecStart=/usr/bin/varnishncsa -a -w /var/log/varnish/varnishncsa.log -F
'%h'

ExecStart=/usr/bin/varnishncsa -a -w /var/log/varnish/varnishncsa.log -F %h

In all cases, the error is:

May 27 08:37:28 CACHE-SRV systemd[1]: varnishncsa.service: Failed to run
'start' task: Operation not supported
May 27 08:37:28 CACHE-SRV systemd[1]: Failed to start Varnish HTTP
accelerator log daemon.
-- Subject: Unit varnishncsa.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit varnishncsa.service has failed.
--
-- The result is failed.
May 27 08:37:28 CACHE-SRV systemd[1]: varnishncsa.service: Failed with
result 'resources'.
May 27 08:37:28 CACHE-SRV polkitd(authority=local)[799]: Unregistered
Authentication Agent for unix-process:18570:14879687 (system bus name
:1.130, object path /org/freedes


For completion, here's the full /etc/init.d/varnishncsa file:

---------------------------------------

#! /bin/sh

### BEGIN INIT INFO
# Provides:          varnishncsa
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start HTTP accelerator log daemon
# Description:       This script provides logging for varnish
### END INIT INFO

# Source function library
. /lib/lsb/init-functions

NAME=varnishncsa
DESC="HTTP accelerator log deamon"
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/$NAME
PIDFILE=/run/$NAME/$NAME.pid
LOGFILE=/var/log/varnish/varnishncsa.log
USER=varnishlog
DAEMON_OPTS="-a -w ${LOGFILE} -D -P ${PIDFILE}"

# Include defaults if available
if [ -f /etc/default/$NAME ] ; then
        . /etc/default/$NAME
fi

# If unset, or set to "0" or "no", exit
if [ -z "${VARNISHNCSA_ENABLED}" ] || \
   [ "${VARNISHNCSA_ENABLED}" = "0" ] || \
   [ "${VARNISHNCSA_ENABLED}" = "no" ]; then
  exit 0;
fi

test -x $DAEMON || exit 0


fi

test -x $DAEMON || exit 0

start_varnishncsa() {
    output=$(/bin/tempfile -s.varnish)
    log_daemon_msg "Starting $DESC" "$NAME"
    create_pid_directory
    if start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
        --chuid $USER --exec ${DAEMON} -- ${DAEMON_OPTS} \
        > ${output} 2>&1; then
        log_end_msg 0
    else
        log_end_msg 1
        cat $output
        exit 1
    fi
    rm $output
}

stop_varnishncsa(){
    log_daemon_msg "Stopping $DESC" "$NAME"
    if start-stop-daemon --stop --quiet --pidfile $PIDFILE \
        --retry 10 --exec $DAEMON; then
        log_end_msg 0
    else
        log_end_msg 1
    fi
}


reload_varnishncsa(){
    log_daemon_msg "Reloading $DESC" "$NAME"
    if kill -HUP $(cat $PIDFILE) >/dev/null 2>&1; then
        log_end_msg 0
    else
        log_end_msg 1
        exit 1
    fi
}

status_varnishncsa(){
    status_of_proc -p "${PIDFILE}" "${DAEMON}" "${NAME}"
    exit $?
}

create_pid_directory() {
    install -o $USER -g $USER -d $(dirname $PIDFILE)
}


case "$1" in
    start)
        start_varnishncsa
        ;;
    stop)
        stop_varnishncsa
        ;;
    reload)
        reload_varnishncsa
        ;;
    status)
        status_varnishncsa
        ;;
    restart|force-reload)
        $0 stop
        $0 start
        ;;
    *)
        log_success_msg "Usage: $0 {start|stop|restart|force-reload|reload}"
        exit 1
        ;;
esac

--------------------------------------------

Even tried to change DAEMON_OPTS directly in /etc/init.d/varnishncsa to:

DAEMON_OPTS="-a -w ${LOGFILE} -D -P ${PIDFILE} -F '%h'"

or

DAEMON_OPTS="-a -w ${LOGFILE} -D -P ${PIDFILE} -F \"%h\""

but the log file format would not change.

Albert


On Fri, May 27, 2016 at 8:50 AM, Per Buer <perbu at varnish-software.com>
wrote:

>
>
> On Thu, May 26, 2016 at 5:05 PM, Albert Tollkuçi <
> albert.tollkuci at gmail.com> wrote:
>
>> SELinux is not running...it looks like a systemd problem, but I have the
>> default installation for Ubuntu, not sure why it's messed up.
>>
>
> You messed it up when you stuck the pipes in there. Remove or figure out
> how to quote them and it should work fine.
>
> There is a manpage called systemd.service or something. It should tell you
> the rules.
>
> --
> *Per Buer*
> CTO | Varnish Software AS
> Cell: +47 95839117
> We Make Websites Fly!
> www.varnish-software.com
> <http://info.varnish-software.com/signature>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>



-- 
Web: http://www.tollkuci.com
Follow me on: LinkedIn <http://www.linkedin.com/in/alberttollkuci> Google+
<https://plus.google.com/+AlbertTollku%C3%A7i/posts> Facebook
<https://www.facebook.com/albert.tollkuci> Twitter
<https://twitter.com/AlbertTollkuci> Career 2.0
<http://careers.stackoverflow.com/atollkuci>
------------------------------

Imagination is more important than knowledge
*Albert Einstein*

The three chief virtues of a programmer are: Laziness, Impatience and Hubris
*Larry Wall*

Men are basically smart or dumb and lazy or ambitious. The dumb and
ambitious ones are dangerous and I get rid of them. The dumb and lazy ones
I give mundane duties. The smart ambitious ones I put on my staff. The
smart and lazy ones I make my commanders
*Erwin Rommel*

The best programmers are not marginally better than merely good ones.  They
are an order-of-magnitude better, measured by whatever standard: conceptual
creativity, speed, ingenuity of design, or problem-solving ability.
*Randall E. Stross*

Measuring programming progress by lines of code is like measuring aircraft
building progress by weight.
*Bill Gates*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20160527/30f53169/attachment-0001.html>


More information about the varnish-misc mailing list