Removing Default Logs and Collecting Application Logs

TLDR Srikanth wanted to remove default logs and collect their application logs. nitya-signoz provided two solutions, and Srikanth chose the second one, which involves editing the ote-collector-config.yaml file.

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 05:21:29 UTC

Hi Team, how can we remove test data? my actual logs is getting mixed with test logs, it's difficult to find actual logs, please help

Photo of Ashu
Ashu
Tue, 06 Jun 2023 05:32:53 UTC

nitya-signoz

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 05:43:54 UTC

By test data do you mean the default logs that are getting collected ? Also are you running SigNoz on docker or kubernetes ?

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 05:45:04 UTC

yes default logs, they're coming up even when i go live

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 05:45:09 UTC

I am running on docker

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 05:46:39 UTC

Just remove `filelog/dockercontainers` from the config to stop default docker logs collection and restart otel-collector

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 05:48:35 UTC

Okay, let me try

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 05:49:13 UTC

How are you sending your application logs and what is your tech stack ?

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 05:51:18 UTC

sending from a nodejs application

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 05:51:43 UTC

just adding it to console and signoz is picking it up

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 05:52:06 UTC

i am able to see my logs just that lot of test data is also seen

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 05:54:18 UTC

Got it the above change not collector your applications logs as well, as by default docker doesn’t support names in log file path like kubernetes. There are a few ways to solve this problem

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 05:55:16 UTC

yeah I restarted the container, not able to see my logs as well

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 05:55:30 UTC

should i revert that change?

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 05:55:46 UTC

• Use logs sdk to send logs directly from your application to signoz • Use this solution This will add container name to your logs though which you can filter your application logs in the UI.

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 05:56:26 UTC

What deployment method do your use to deploy your apps in prod? docker or k8s ? based on that I can suggest one of the above solutions

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 05:57:05 UTC

currently I am just working on a poc in my local, it'll mostly be using docker

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 05:57:33 UTC

we're using winston logger throughout so I don't think 1st solution is enough right?

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 06:00:10 UTC

Both of the solutions will work, but code level changes will be required for 1st and here is the example for that . • If you will use docker in prod then go with the second solution. It will help you collect and filter logs of other applications as well.

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 06:00:53 UTC

yeah even I felt 2nd one is better

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 06:01:09 UTC

where can i find more details about it

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 06:01:57 UTC

The comment I have linked is self sufficient, let me know if you don’t understand something.

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 06:03:00 UTC

Okay sure, I'll have a look and get back to you

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 06:03:07 UTC

Thanks a lot!

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 06:16:54 UTC

nitya-signoz the changes that you have showed should be made in which file?

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 06:17:27 UTC

The ote-collector-config.yaml file

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 06:17:49 UTC

okay got it

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 06:18:23 UTC

and the listen_address should be what?

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 06:18:42 UTC

can it be the same whatever you have mentioned

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 06:19:04 UTC

yes

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 07:23:32 UTC

nitya-signoz I am getting the following error 2023/06/06 06:23:51 !! dial tcp 0.0.0.0:2255: connect: connection refused

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 07:23:40 UTC

I think i need to export 2255

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 07:23:53 UTC

how can we do that in this yaml?

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 10:21:45 UTC

Yeah please add `2255` to the ports of otel-collector have updated the comment as well

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 10:28:13 UTC

okay

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 10:32:54 UTC

the following is the output that i see now `` 2023/06/06 10:31:59 # logspout v3.2.14 by gliderlabs 2023/06/06 10:31:59 # adapters: raw syslog tcp tls udp multiline 2023/06/06 10:31:59 # options : 2023/06/06 10:31:59 persist:/mnt/routes 2023/06/06 10:31:59 # jobs : http[routes,health,logs]:80 pump routes 2023/06/06 10:31:59 # routes : # ADAPTER ADDRESS CONTAINERS SOURCES OPTIONS # syslog+tcp 0.0.0.0:2255 map[] 2023/06/06 10:31:59 http[logs,routes,health]:80 ended: listen tcp 0.0.0.0:80: bind: address already in use

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 10:33:57 UTC

Give me a few mins, I am checking this.

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 10:34:43 UTC

thank you!

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 10:39:23 UTC

I am able to run it fine, lets do a 5 mins huddle

Photo of Srikanth
Srikanth
Tue, 06 Jun 2023 10:39:46 UTC

yes

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 10:50:32 UTC

```sudo docker run --rm --name="logspout" --volume=/var/run/docker.sock:/var/run/docker.sock gliderlabs/logspout ```

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 10:58:45 UTC

Photo of nitya-signoz
nitya-signoz
Tue, 06 Jun 2023 11:16:43 UTC