-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Write([]byte)
to log full message to message
field
#11
Comments
Makes sense to me! The |
Oh, I wasn't clear in the original post; we also have the I'll update the issue above with this information. |
I would suggest at the same time updating the documentation of the GELF payload to reflect this understanding that the |
Please use the branch |
I take it you've decided not to bring in this change for I'm not clear on how using My suggestion is this:
|
v2 is master currently, so if there is no other work going on it stays the same. When there are API changes and refactorings we will branch v3 of of it. Just that you take the merged TCP feature into account when you do something there. |
So for non-API-changing commits, I should be submitting PRs to That's fine, but I'd suggest you document this somewhere obvious from the main page for this repo, because people are unlikely to notice it buried deep in this issue. |
Following the principle of least surprise, we write messages completely into thethe `short_message` field, even if they contain several lines. As a consequence, we deprecate the `full_message` field, as it becomes redundant. Resolves Graylog2#11
Following the principle of least surprise, we write messages completely into thethe `short_message` field, even if they contain several lines. As a consequence, we deprecate the `full_message` field, as it becomes redundant. Resolves Graylog2#11
Following the principle of least surprise, we write messages completely into the `short_message` field, even if they contain several lines. To not break gelf standard, we also write the full message, always, to the `full_message` field. Resolves Graylog2#11
Following the principle of least surprise, we write messages completely into the `short_message` field, even if they contain several lines. To not break gelf standard, we also write the full message, always, to the `full_message` field. Resolves Graylog2#11
[This is in part a continuation of a discussion started in PR #9 where we were also worried about message length.]
The
message
field (sent asshort_message
in GELF) and thefull_message
field are stored in the exact same way in Elasticsearch, so presumably they support the same sizes. I've actually testedmessage
only up to 80 KB (via a null-delimited "RAW/Plaintext" interface) and 2500 lines or so, however. :-) It works fine, and the Graylog UI seems to do a reasonable job of dealing with it. (I have seen a complaint that long fields don't work, but that appears to be because they changed the default configuration to do term analysis on themessage
field, which isn't done by default.)Having looked into this a bit, I find:
full_message
is optional to send in GELF, unlikemessage
.full_message
is not parsed for things like sources and timestamps.On its syslog inputs, Graylog has a
store_full_message: true
option which stores the raw syslog protocol message (usually RFC 5424 in thefull_message
field. This seems useful for debugging and handling situations where bad messages come in that the parser can't handle. We turned this on when we set up Graylog because it seemed like a good idea at the time, and it still doesn't strike me as a bad thing to do.Graylog search functionality seems to be oriented mainly towards
message
and it seems to take a bit of extra work to searchfull_message
instead.From all this, I get the sense that
full_message
is considered something that can be safely ignored by clients retrieving and processing messages from Graylog. Given that, I think it's a bad idea, when given a message via theio.Writer
interface, not to put the entire message into themessage
field.As background, let me tell you about my use of Graylog at work. We have dozens of servers generating log messages into the Systemd Journal that we forward to a central Graylog installation so we can easily query across servers, do centralized analysis (such as with OSSEC LIDS log analysis), keep historical records, and so on.
In order to keep things as simple as possible, I'm aiming to get all our non-journal logging also going into the journal, including logs from programs that write directly to
/var/log
such asauditd
, output of jobs run bycron
, and so on. (For example, I'm intending to replace/usr/sbin/sendmail
on those servers with a program that eats the message and logs it to the journal.)One of the questions I had to ask myself is whether I should be using the
full_message
field, and what with various programs partially duplicating information acrossmessage
andfull_message
, that seems like a bad idea. How would the OSSEC log scanner, for example, know that for some log entriesfull_message
is all the information inmessage
and a few other fields in unparsed form, yet for other messagesmessage
could be an incomplete log message andfull_message
contains the complete message but without other log entry information such as the timestamp? That way lies a lot of pain, especially if I end up having to assemble new versions of log entries for log-scanning software that expects things to be re-assembled in a syslog-ish format with the timestamp, source etc. all in one big string.So for these reasons, I'm suggesting we change the
io.Writer
API,Write([]byte)
, ofgo-gelf
to record the entire bytestring it's handed in themessage
field and not send afull_message
field. I think it's reasonable for it to continue adding things like the extra fields for file and line number of the caller.Note that if anybody does want to use the
full_message
field for something, or any other fields for that matter, we have theWrite(*Message)
interface for that which allows (or should allow) full control over the GELF message being sent, within the limitations of the protocol. (We should not allow, e.g., a GELF message to be sent without amessage
field since that field is required by the protocol.)If we're agreed on this, I'm happy to submit a PR for changes to the code and update the documentation appropriately, including this rationale in an appropriate place (probably the commit message).
The text was updated successfully, but these errors were encountered: