-
Notifications
You must be signed in to change notification settings - Fork 41
Forward structured application JSON logs, optionally enriched with ECS fields #258
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
Comments
hello @pushred, sorry for the late reply just to be sure I got right your scenario: you send the logs collected with the would you be able to use the cloudwatch logs log group (or log stream) as direct input of the forwarder? in this case the original json logs won't be wrapped by the subscription format to the kinesis data stream and you won't need any unfolding I have the impression you have already added the
I understand your expectation but that's not the current behaviour of the ESF in your scenario each kinesis record has the following payload
this payload is already parsed as JSON, and on top of that you expand the entries in the problem is that if you had directly the cloudwatch log group/stream as input of the forwarder the scenario would be different:
and the forwarder would sent to ES the following event:
I would expect you will be then able to run the following processor (or something similar):
it's unclear to me where does the even assuming you stick to the format of the subscription filter to the kinesis data stream you should be able to run something like the following ingest pipeline:
do I miss anything? there's no plan at the moment to add a feature to merge the content of a json field in the forwarder event to the root of the event directly in the forwarder: it's intended for such kind of processing to be taken care of in an ingestion pipeline, once you are given the ability to isolate single event to be forwarded (like using |
Exactly
We pursued this option originally but the issues noted in #219 lead us to Kinesis.
Correct we are using this and it does remove the Kinesis structure.
I tried a pipeline this actually and ran into this error: {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "cannot add non-map fields to root of document"
}
],
"type": "illegal_argument_exception",
"reason": "cannot add non-map fields to root of document"
} We weren't able to make sense of it however and have ended up with a very verbose pipeline using Set to copy values from
Understood. In the end the ingest pipeline did meet our needs and I can see the benefit of not abstracting this away and preserving flexibility. Also understood the decision noted elsewhere to delegate data transformation to ingest pipelines. This was just not a trivial "out of the box" experience, especially for me personally who hasn't worked with the Elastic stack much before. The number of Lambda functions in our project is definitely a complicating factor and maybe not so common. I thought I should file an issue to provide the feedback and for reference by anyone else in the future who might face similar obstacles. |
I'd suggest you to open a thread in the https://discuss.elastic.co/c/elastic-stack/elasticsearch/6 about that.
sure, you did right to file an issue: knowledge will stay here for future users facing your same problems. |
Describe the enhancement:
I am using the Kinesis input to collect structured logs from AWS CloudWatch that have been partly populated using the ecs-pino-format library. Inspecting the data output to Elasticsearch I found that there are a couple layers of structure around my application logs:
message
fieldmessage
fieldI was expecting to see my application logs as-is. This could be achieved if:
message
string was attempted to be parsed as JSONmessage
is valid JSON, merge the content into the root object that is forwardedmessage
is not JSON, preserve it as-isDescribe a specific use case for the enhancement or feature:
When I initially saw this I thought that it was a reasonable preservation of the various layers my logs are passing through. I assumed that I could use Ingest Pipelines to parse each layer, extract my logs, and merge them into the ESF structure in order to leverage some of it's ECS content while adding my own. For reference, here's a portion of my pipeline:
However I have encountered some limitations in the pipeline processors that are currently blocking me from accessing a
log.level
field that ecs-pino-format is adding.In my own case I may need to stop using ecs-pino-format as I don't see the blocking issues in the data processors being resolved anytime soon. I don't really expect that this enhancement will be implemented either. But I wanted to at least document what I'm dealing with as a user.
The text was updated successfully, but these errors were encountered: