ptv-logistics/Log4ALA

DEFAULT_MAX_FIELD_NAME_LENGTH should default to lower than 500

Closed this issue · 2 comments

This is admittedly minor. Due to a bug in our code we were logging long messages that happened to contain the same delimiters used by Log4ALA (";" and "=") to parse fields from messages. As a result there were a few custom fields created in Log Analytics that had exceedingly long names.

Deleting these from Log Analytics has been problematic - Azure throws an illegal URL error when I try to delete these fields. I assume that the length of the name is causing difficulty internally.

I know this was stupid on our part. But there probably isn't a valid reason to ever have field names > 100 or so. I encode any instances of ; or = that appear in our log messages now but this might save a headache for somebody in the future.

Hi @bknabel ,

to avoid the problems with same delimiters used by Log4ALA you can use the following settings since version 2.3.4 :

"keyValueSeparator": "[=]",
"keyValuePairSeparator": "[;]"

to configure any other single char or multiple chars as separator for the keyValue detection in the log message (https://github.com/ptv-logistics/Log4ALA#features under bullet point 9)

Or set the property maxFieldNameLength (overwrites DEFAULT_MAX_FIELD_NAME_LENGTH):

"maxFieldNameLength ": 100

Hi @moberacker
Thanks for the reply. We're actually using the delimiters provided by Log4ALA. I just needed to encode the field value that we log in case somebody included one of the delimiters in the text of the log by mistake. Not a big deal.

I know I can change the max length of the fields can be changed in the settings. I just thought that the default value provided by for DEFAULT_MAX_FIELD_NAME had the potential to cause headaches if somebody wasn't careful. In any case it was more of a suggestion than a real issue.

Thanks for the help.