How to act upon error log additions? - linux

Normally I watch logs using tail -f /the/error.log, but I normally only act upon them when I hear people complain. I know you can send them to an email address, but email simply sucks. So I rather want the error logs of my server to be sent to a dedicated slack channel.
My question is: how can I watch additions to the error log and catch those additions in a variable so I can send them as json to the slack webhook? I also wonder, what if the error logs is more than one line? I don't want a 20-line error to be sent as 20 separate messages.
All tips are welcome!

Related

GCS Object Change Notification, pub/sub unable to receive any thing

Following up to quesiton! since I can't comment.
I followed #Brandon Yarbrough instruction everything is configured the problem is I am not receiving anything script saying
Listening for messages on projects/[project_id]/subscriptions/projects/[project_id]/subscriptions/subtestbucketthhh

What config option allows bot to respond to commands posted by itself?

If I have en external process post a message as bot, let's say !help how can make Errbot respond to it? Currently it ignores messages coming from errbot itself. I could not find a configuration option for this.
Good question: It is in the contract of each backend to detect and filter out the messages coming from the bot itself.
This design choice is mainly to avoid weird infinite loop behavior etc.
In general if the bot emits something and needs to react from it, why not doing that at that point instead of waiting for its own response?

How to read message thread in Java mail?

I am developing an email client. I have being able to retrieve messages from server (Dovecot imap). I am not able to retrieve or to show the related reply messages. This concept is know as message thread. Can anyone help me about how to get this message thread in Java mail?
I tried using gimap (Google imap) lib but got confused.

Socket Send(2) - How to send an error message from server to client

I'm doing some very simple TCP socket programming right now and I have a small problem I can't seem to find the answer to. Basically, what I'm building is a server program and a client program that allow the client to request a file from the server and the server will send it.
My problem is that if the client requests a file that the server doesn't have I need to send an error message back to the client. Is there a flag that I can set to do this? I can't just send a string containing an error message because it is possible that that message could appear in a file transfer at some point and trigger an incorrect response.
I have looked through the MAN pages and some other resources but I couldn't seem to figure it out. I'm working in a Linux environment.
Thank you!
See comments on my original post from kaylum and Remy Lebeau for the solution.

Dulplication of messages in group chatting project in J2ME

I want to send group messages but when I am sending it first time its working fine but after when I received it, it occurs duplication of the messages. Number of duplication of sending messages is equal to number of received messages.
I tried to use Message Connection for sending message.
I have faced a similar issue.
The best solution for such is to give your messages an id value before sending them. You could encode in JSON.
Then check for the existence of the message id (if it doesnt exist) before storing/rendering the message.

Resources