Ask Your Question

puppetlabs/apache log_formats issue

asked 2014-08-29 03:17:51 -0500

mwolf gravatar image

Using the latest puppetlabs/apache I can't set a log_format variable when using apache::vhost.

For example:

class profile::test::webserver {

  class { 'apache': }

  apache::vhost { '':
    port => '80',
    docroot => '/var/www/first',
    $log_formats = { vhost_common => '%v %h %l %u %t \"%r\" %>s %b' }

Puppet parser validate gives the following error:

Error: Could not parse for environment production: Syntax error at 'log_formats'; expected '}' at /etc/puppet/manifests/test/profiles.pp:8

The $log_formats here is a copy from the puppetlabs/apache readme.

Even when using apache::vhost setting a normal variable gives the same error, for example:

class profile::test::webserver {

  class { 'apache': }

  apache::vhost { '':
    port => '80',
    docroot => '/var/www/first',
    #$log_formats = { vhost_common => '%v %h %l %u %t \"%r\" %>s %b' }
    $testing = "hello World"

That gives the same error.

Versions using:

Puppet 3.6.2

puppetlabs/apache 1.1.1

puppetlabs-stdlib 4.3.2

puppetlabs-concat 1.1.0

I've also tried the latest built of this apache module from github, but same error. Am I missing something, or could this be a bug?

I hope someone can help me with this, thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-08-29 10:19:22 -0500

ramindk gravatar image

Your syntax is completely broken. You can not define some random variable in the middle of a resource stanza. Something like the following might work.

$testing = 'blah'
file { 'mytest':
  ensure  => file,
  content => $testing,

Additionally $log_formats is not defined within the vhost. If you want to set it, you need to do it like this. And then you can use that log format within the vhost define.

class { 'apache': {
  log_formats => { vhost_common => '%v %h %l %u %t \"%r\" %>s %b' },
apache::vhost { 'testing':
   access_log_format => 'vhost_common',
edit flag offensive delete link more


Thanks for your help, got it working now!

mwolf gravatar imagemwolf ( 2014-09-01 02:43:06 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-08-29 03:17:51 -0500

Seen: 539 times

Last updated: Aug 29 '14