Forwarding logs to Lambda on current project's deployment
kiesel opened this issue · comments
I'd like to use this plugin to forward logs to a common function that is part of the project itself. There are two problems that need to get resolved for this to work:
- Addressing of the function
Today, one needs to write the full ARN - including region & accountId - into the configuration. I'd like to use the function name to address the function, so it'd be unnecessary to hardcode the other values - Omit a log subscription for the target function
The so-configured target function should be omitted from the logging itself, as this would create a recursion.
What do you think?
-
That sounds like a useful feature. If you have time to make a PR then we can definitely get that added in.
-
You can handle this by putting the target function into a separate Serverless project and deploy it independently without using the plugin. This would also help you reuse it for other Serverless projects in the future.
FYI, found a work around
...
functions:
logForwarder:
handler: logforwarder.handler
logForwarding:
enabled: false
plugins:
- serverless-log-forwarding
custom:
logForwarding:
destinationARN: !GetAtt LogForwarderLambdaFunction.Arn
...
This has exactly the same behavior that you are asking.
Awesome, then this request is obsolete.