Documentation ¶
Overview ¶
log_to_nsq is an example program that demonstrates the use of apexovernsq. When invoked with the IP adress and port of one or more running nsqd and a topic name, it will pu sh two structured log messages to that nsq daemon (or deamons) and then exit.
To see this working the following three things should be invoked.
1. Start the nsqdaemon:
nsqd
... take note of the port number for TCP that it informs you of.
2. Start nsq_tail:
nsq_tail -topic log --nsqd-tcp-address <IPADDRESS:PORT>
Not that <IPADDRESS:PORT> should be replaced with the IP address of the machine where nsqd is running and the port number you took note of in step one.
3. invoke this program:
./example -nsqd-address <IPADDRESS:PORT> -topic log
This program should exit almost immediately, but if you check the nsq_tail process you should see some output that looks like this: {"fields":{"flavour":"pistachio","scoops":"two"},"level":"info","timestamp":"2017-08-04T15:48:22.044783085+02:00","message":"It's ice cream time!"} {"fields":{"error":"ouch, brainfreeze"},"level":"error","timestamp":"2017-08-04T15:48:22.047870426+02:00","message":"Problem consuming ice cream"}