You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Andrew Munn <an...@nmedia.net> on 2014/11/10 01:29:40 UTC

Custom appender needed to HTTP POST log msgs?

I use the Slack chat application and I can post msgs to it using http POST 
like this:

curl -X POST --data-urlencode 'payload={"channel": "#general", "username": 
"webhookbot", "text": "This is the errort.", "icon_emoji": ":ghost:"}' 
https://me.slack.com/services/hooks/incoming-webhook?token=xxxx

Is there a way to configure an off-the-shelf appender to HTTP POST log 
messsages like this directly?  Or do I need to create a custom appender?  
I know I could just log to a file, tail the file, and piece together that 
curl command in a shell script each time the file is appended to. 

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Custom appender needed to HTTP POST log msgs?

Posted by Daniel Widdis <wi...@gmail.com>.
I don't see anything off-the-shelf that fits.

I recently wrote a custom appender for HipChat (looks similar to Slack) 
that you could probably tweak pretty easily, just changing the api 
calls.   An HTTP or curl appender would be nice to have alongside the 
SMTP one!

https://github.com/dbwiddis/log4j2-hipchat

Dan

On 11/9/14, 4:29 PM, Andrew Munn wrote:
> I use the Slack chat application and I can post msgs to it using http POST
> like this:
>
> curl -X POST --data-urlencode 'payload={"channel": "#general", "username":
> "webhookbot", "text": "This is the errort.", "icon_emoji": ":ghost:"}'
> https://me.slack.com/services/hooks/incoming-webhook?token=xxxx
>
> Is there a way to configure an off-the-shelf appender to HTTP POST log
> messsages like this directly?  Or do I need to create a custom appender?
> I know I could just log to a file, tail the file, and piece together that
> curl command in a shell script each time the file is appended to.
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org