-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Filebeat modules: keep raw message #8083
Comments
I think we can continue with the PR. |
In #8448 many people provided feedback regarding this feature. I am collecting my thoughts here, because I am proposing a different solution, so I might close the PR. I consider #8950 as a related issue, we can solve both problems with the same solution. I think keeping original messages can be turned on by default, because the field containing the raw message will not be indexed. If something is not indexed it, it can be compressed better. Ref: #8448 (comment) I think keeping raw messages are relevant in two cases in Filebeat: JSON messages and modules. These two elements are given by Filebeat and there is no other way to reprocess the input once Filebeat did its own thing. The first case, JSON parsing, is straightforward. The raw string is copied and added to the event. The second case is a bit more complex as there are at least two possible solution. So far we have tried copying the raw message when the message is processed by Filebeat. However, I think it would be a better solution to handle keeping the raw message on ES (or possibly on LS side). All module pipelines contain a processor which removes the element If We already have minimal control over pipelines by templates (e.g In other cases, for example user defined pipelines, the responsibility of keeping the raw message can be delegated to our users. As those users are know enough to create their own pipelines, they can take care of keeping unprocessed messages. |
Just dropping by, wearing my ECS hat. We've called this log.original in ECS, so +1 on |
If we decide to move the handling of keeping the raw message to ingest pipelines it means no processing like Let's not offer users to store the data in something else then Proposal for moving this forward:
Like this we can get the functionality and then focus the discussion on if it should be on or off by default. |
In our internal discussion we decided to add two new processors; one for copying and one for truncating messages. Exposing the functionality as processors is more flexible and gives more control to users. |
Closing as both Example configuration to keep raw message: processors:
- copy_fields:
fields:
- from: message
to: event.original
fail_on_error: false
ignore_missing: true
- truncate_fields:
fields:
- event.original
max_bytes: 1024
fail_on_error: false
ignore_missing: true |
Hi, I have tried keeping the original line (json) from json log with suggested processors but the result is the same. Tried to run the processor against json field together with json.keys_under_root: false and the result is the same as json.*, expected. When using json.keys_under_root: false the filebeat writes to its log that it is trying to push the json line (block) from the json log with "json" parent key. When using json.keys_under_root: true the filebeat writes to its log that it is trying to push the json line (block) from the json log without parent key. Again, expected, but what i can't figure out is at what moment the processor should copy the original message and write it as value of the "message" key while parsing json log? This is exactly the case no.1. from above if i am not mistaken. Maybe i am missing something, please do offer a suggestion if possible. I am pasting filebeat.yml:
Thank you! |
We are parsing our json logs to parent key 'json' and use the following processor to restore the raw message: - script:
when:
and:
- has_fields: ["json"]
- not:
has_fields: ["message"]
lang: javascript
id: json_stringify
source: >
function process(event) {
var jsons = event.Get("json");
if (jsons != null) {
event.Put("message",JSON.stringify(jsons));
}
} Hope this helps and hopefully the Elastic boys will implement a flag for the inputs to keep raw messages when parsing JSON. |
Any news? Same issue, I don't have original log even with copy_fields processor. |
Filebeat modules parse and remove the original message. When original contents is JSON, the original message (as is), is not even published by filebeat. For debugging, re-processing, or just displaying original logs, filebeat should be able to publish the original unprocessed contents as well.
log.message
log.message
. Enabled by default (document this as backwards incompatible change)The text was updated successfully, but these errors were encountered: