feature-pack: setting access logging

26 views
Skip to first unread message

Mike Douglass

unread,
Dec 27, 2021, 10:54:50 PM12/27/21
to WildFly
I'm trying to configure the access-log setting for a host in a layer-spec

What I want to achieve is this:

<access-log pattern="%h %l %u [%t] &quot;%r&quot; %s %b &quot;%{i,Referer}&quot; &quot;%{i,User-Agent}&quot;"/>

All those &quot; are in the actual value.

I have this setting:

<feature spec="subsystem.undertow.server.host.setting.access-log">
  <param name="pattern" value="%h %l %u [%t] &quot;%r&quot; %s %b &quot;%{i,Referer};&quot; &quot;%{i,User-Agent}&quot;"/>
</feature>

What I actually get as a result is this:

<access-log pattern="%h %l %u [%t] &quot;%r&quot; %s %b" worker="default"/>

I tried adding a few dashes just to fill it out:

<param name="pattern" value="%h %l %u [%t] &quot;%r&quot;-------- %s %b &quot;%{i,Referer}&quot; &quot;%{i,User-Agent}&quot;"/>

and that gave me

<access-log pattern="%h %l %u [%t] &quot;%r&quot;-------- %s %b" worker="default"/>

so it's not simply truncating. I did wonder if it was the "{" so I tried numeric entities - no luck.

Any ideas what's up?

Mike Douglass

unread,
Jan 4, 2022, 10:40:02 PMJan 4
to WildFly
I did find I can set this correctly from the console - this command works OK:

/subsystem=undertow/server=default-server/host=default-host/setting=access-log:write-attribute(name=pattern,value="%h %l %u [%t] &quot;%r&quot; %s %b &quot;%{i,Referer}&quot; &quot;%{i,User-Agent}&quot;")

The content of the feature pack is correct so it appears to happen during galleon processing.

Jean Francois Denise

unread,
Jan 6, 2022, 5:58:59 AMJan 6
to wil...@googlegroups.com
Hi Mike,
The &quote; is handled at the XML parsing level (in the layer-spec.xml and in the standalone.xml parsers).
The CLI command shouldn't contain &quot;. If you look at the resulting content you will see some &amp; added.
You need to quote the whole value and escape the quote contained in the quoted string.

The syntax in layer-spec.xml should be: <param name="pattern" value="&quot;%h %l %u [%t] \&quot;%r\&quot; %s %b \&quot;%{i,Referer};\&quot; \&quot;%{i,User-Agent}\&quot;&quot;"/>
In CLI: /subsystem=undertow/server=default-server/host=default-host/setting=access-log:write-attribute(name=pattern, value="%h %l %u [%t] \"%r\" %s %b \"%{i,RefererFoo};\" \"%{i,User-AgentFoo}\"")

Thank-you.
JF
--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/8b402c2a-8c79-465c-8bae-87ce61f016dan%40googlegroups.com.


Reply all
Reply to author
Forward
0 new messages