[logback-user] POST data in log

Matt Zagrabelny mzagrabe at d.umn.edu
Mon Jun 17 19:55:42 UTC 2024


Greetings,

I'm attempting to configure a logback application (puppetdb) to log POST
data, but I'm not seeing the options at:

https://logback.qos.ch/manual/layouts.html#AccessPatternLayout

I can get curl to output the POST data via --trace-ascii

puppetdb# curl -H 'Content-type:application/json' -d '{ "query":
["extract", ["certname"], ["and", ["=", "type", "Class"], ["=", "title",
"Postgresql::Server"] ] ] }' --trace-ascii - http://localhost:8080
/pdb/query/v4/resources

== Info:   Trying 127.0.0.1:8080...
== Info: Connected to localhost (127.0.0.1) port 8080 (#0)

=> Send header, 153 bytes (0x99)
0000: POST /pdb/query/v4/resources HTTP/1.1
0027: Host: localhost:8080
003d: User-Agent: curl/7.88.1
0056: Accept: */*
0063: Content-type:application/json
0082: Content-Length: 111
0097:
=> Send data, 111 bytes (0x6f)
0000: { "query": ["extract", ["certname"], ["and", ["=", "type", "Clas

0040: s"], ["=", "title", "Postgresql::Server"] ] ] }

<= Recv header, 17 bytes (0x11)
0000: HTTP/1.1 200 OK
<= Recv header, 37 bytes (0x25)
0000: Date: Mon, 17 Jun 2024 19:49:24 GMT
<= Recv header, 46 bytes (0x2e)
0000: Content-Type: application/json;charset=utf-8
<= Recv header, 35 bytes (0x23)
0000: Vary: Accept-Encoding, User-Agent
<= Recv header, 20 bytes (0x14)
0000: Content-Length: 43
<= Recv header, 2 bytes (0x2)
0000:
<= Recv data, 43 bytes (0x2b)
0000: [{"certname":"foo.example.com"}]
[{"certname":"foo.example.com"}]== Info: Connection #0 to host localhost
left intact

I did add the '%fullRequest' option:

<encoder>
    <pattern>%h %l %u [%t] "%r" %s %b "%i{Referer}" "%i{User-Agent}" %D
%header{X-Uncompressed-Length} %fullRequest</pattern>
</encoder>

...but I'm not seeing the POST data:

127.0.0.1 - - [17/Jun/2024:14:49:24 -0500] "POST /pdb/query/v4/resources
HTTP/1.1" 200 43 "-" "curl/7.88.1" 12 - POST /pdb/query/v4/resources
HTTP/1.1
Content-type: application/json
Accept: */*
User-Agent: curl/7.88.1
Host: localhost:8080
Content-Length: 111

Does anyone have any ideas how to see the POST data via logback?

Thanks for the help!

-m
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20240617/c304aedd/attachment.htm>


More information about the logback-user mailing list