Search code examples
apache-nifiel

Apache Nifi LogMessage and PutSlack Processors


I have a simple flow: GenerateFlowFile -> FetchGCSObject (on failure) -> LogMessage -> PutSlack.

In PutSlack for the Webhook Text, I have the value of Dynamic Message: ${"Log message"}. However, in my Slack channel, I see Dynamic Message:

Not for sure what I'm doing incorrectly, any help is appreciated.

This answer Pass data (e.g. log message) from processor to Slack or LogMessage processor seems to suggest that I can use Expression language. I've tried ${'Log Message'}, ${"Log Message"}, ${"Log message"}, ${'Log message'}, ${Log Message}, ${message}, ${"message"}, but nothing seems to work.

I also tried: ${log-message} and ${"log-message"} and those did not work. I tried that based on the code found here: https://github.com/apache/nifi/blob/rel/nifi-1.22.0/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/LogMessage.java.

Note that I am able to pass down properties from the GenerateFlowFile and PutSlack utilizes those values.


Solution

  • The LogMessage Processor doesn't have any Write attributes, which doesn't add anything to the flowFile. If one wanted to just have a single place to reuse a log message, the option would be to use: UpdateAttribute -> LogMessage (use expression language for the new attribute) -> PutSlack (use expression language for the new attribute).

    Thank you Saeed Mousazadeh for conversing with me to help better understand Nifi