[ 
https://issues.apache.org/jira/browse/SOLR-14699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17551491#comment-17551491
 ] 

Jan Høydahl commented on SOLR-14699:
------------------------------------

I see that you, with PatternLayout logging, will get the "msg" part of the log 
line formatted as JSON, which is then fairly easy to split out from the log 
line and parse.

But my concern - and I may be mistaken here - was if you want to switch Log4j2 
to an OOTB JsonTemplate laoyout, the resulting line would be something like this
{code:java}
{"@timestamp":"2019-08-06T12:09:12.375Z", "log.level": "INFO", 
"service.name":"solr", 
"message":"{\"path\":\"/admin/info/system\",\"params\":\"wt=json&_=1653661797425\",\"status\":0,\"QTime\":4}"}
 {code}
...which would show the JSON as text in Splunk, ELK etc, while if we put 
"path", "params", "status" and "qtime" in MDC, there would be a possibility 
(depending of Json Template) of a log line such as this:
{code:java}
{"@timestamp":"2019-08-06T12:09:12.375Z", "log.level": "INFO", 
"service.name":"solr", "message":"/admin/info/system", 
"solr":{"path":"/admin/info/system", "params":"wt=json&_=1653661797425", 
"status":0, "qtime":4}} {code}
...which would likely (I'm no expert here) show up as filterable/queryable 
metadata in the client's log processing platform, instead of one huge escaped 
string.

> Solr request logs should escape names, values 
> (SolrQueryResponse.getToLogAsString)
> ----------------------------------------------------------------------------------
>
>                 Key: SOLR-14699
>                 URL: https://issues.apache.org/jira/browse/SOLR-14699
>             Project: Solr
>          Issue Type: Improvement
>          Components: logging
>            Reporter: David Smiley
>            Priority: Minor
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> {{SolrQueryResponse.getToLogAsString}} encodes the NamedList into a String 
> with simple space-separated pairs with name=value.  However, it does no 
> escaping/encoding, and as-such a value might itself contain spaces and 
> equals.  This is a problem if these logs are being parsed, and we'd like to 
> ensure we do so correctly.  Note that SolrLogPostTool (aka "postlogs") parses 
> these logs.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to