send dummy logs to my docker fluentbit agent - fluent-bit

I have installed fluentbit agent on my docker and also exposed the port 24224 to my localhost.
How do I send a dummy log to my fluentbit docker agent ?
For what I understand is when I will send a log to :24224 somehow, the agent will do some processing on logs and will send it to localhost:8006
which should be captured in my otel-collector.
I have done all the setup, all I missing is -- a dummy log to test the scenario.
Thanks in advance !

docker run --log-driver=fluentd -t ubuntu echo "Testing a log message"
The command is mostly self explanatory for docker users, I have added a description for the ease of understanding.
The command simply follows docker run syntax
docker run [OPTIONS] IMAGE [COMMAND]
IMAGE=ubuntu
This command simply uses the ubuntu docker image.
COMMAND= echo "Testing a log message"
runs the basic echo command.
the main helpful portion is log-driver
Appearantly, ubuntu docker image supports several log drivers, this list also includes fluend -- which will automatically send the message to localhost:24224 without specifying port !
There might be other tools which can be configured to send logs to localhost:24224, this is one of those many solutions which came handy !

Related

Website available even with no NGINX processes running

I have pulled into my web server so it has the latest code from my repo, i try to restart nginx - this doesnt do anything.
So I try the command
sudo nginx -s stop, and get the response that its failed because there is no such file or directory "run/nginx.pid" failed.
Trying to run the command ps aux | grep nginx gives me the response: unsupported option (BSD syntax) -- it actually comes out as ps aux > grep nginx in the digital ocean console.
Basically it seems that even though there are apparently no nginx processes running (although the command to check isnt working) my website is still running and using the old code, is there a way for me to check more definitively on the running processes?
Thanks if you can help.
Try sudo netstat -plunt to check if there's any nginx process running. See if there's anything running on port 80 or 443 and then look at the corresponding program name. You might have another server running possibly apache since it ships by default with most distributions which may be why nginx failed to start.
Another reason why it won't start might be due to faulty config. Go to /etc/nginx/ and double check that it's correct. You can also run sudo nginx -t to ensure that the config syntax is correct.
Alternatively, just check your nginx access log to see if it's actually serving any requests. You can also check the error log to see why it might fail to start. These resides in /var/log/nginx by default or check your nginx.conf for any custom path to logs.

Host key verification failed. in docker

I wanted to launch the jenkins which is installed through docker automatically in browser.. im working on windows os. in docker base os is ubuntu.. then i used solution from this link1.now im getting following error when i ssh using -v command i find that "read_passphrase: can't open /dev/tty: No such device or address"
by going through many websites i have created ssh file through windows using gitbash it contains id_rsa,id_rsa.pub,known_hosts files.
Now what should i do to launch the jenkins file in browser which is build using docker
I'm just going to address the error message you pasted for now.
ssh is trying to get keyboard input for the passphrase on your private key, but can't open the terminal correctly. Are you running the ssh command directly in the terminal, or from a script? If not, try running ssh directly. If you need to run ssh from a script:
Maybe try with keys that don't have a passphrase.
If you can use ssh-agent: Run eval $(ssh-agent), then run ssh-add and enter your passphrase. ssh will no longer prompt for a passphrase now.

ssh command -T option

I'm wondering what the -T option in the following command does, cannot see this option in the manual somehow:
$ ssh -T git#gitlab.com
Welcome to GitLab, Simeon !
Could somebody explain?
I explained before what TTY was: a text terminal is needed when you open an interactive session to a remote server.
But: in the context of a remote Git repository hosting server (GitHub, Gitlab, BitBucket, ...), no remote server will ever allow you to open an interactive session (for security reason)
Then only reason why you would still do an ssh -T git#github.com would be to test if you are correctly authenticated, and the session would immediately end with:
Hi username! You've successfully authenticated,
but GitHub does not provide shell access.
Since no tty is needed for that test, you should use the -T option when making this test.

Dokku view logs? (hosted on digitalocean)

So I just started using dokku (with postegres). My app works on Heroku so I'm pretty sure it's a deployment issue. The app seems to be running but is however hitting issues at log in. I did dokku logs my_app_name however the logs seems to be old. On heroku whenever there is an issue there is an corresponding log, but here I cannot find.
Any ideas are appreciated! Thanks!
To get a continuous log you can type:
dokku logs yourappname -t
It acts as the tail -f command on linux and mac systems.
Dokku logs - docs
I think you can try to use docker logs -f `cat /home/dokku/<app-name>/CONTAINER for getting access to the logs.
In case if you want to see the logs of the specific container:
docker ps
then find your container with postgresql for example and run docker logs -f <CONTAINER_ID>
I hope it could help you to find out the problem.
Out of the topic I found dokku-alt and using it in my current DO image. If you are working with Ruby it's working out of the box comparing with original dokku project.
The easiest:
dokku logs -t *app_name*
up to 300000 lines:
dokku logs -t -n 300000 *app_name* > logs.txt
complete log of container: (needs to be executed on server)
docker container list # to get the container id
docker logs *container_id* > logs.txt
It may not be the answer you are looking for but I was seeing the same issue. I just waited about 30 seconds and the logs were updated. I don't know why they are updated live, but they eventually came through.

ssh to execute all commands in guest machine

i was created a bash script my_vp.sh that use 2 command:
setterm -cursor off
setterm -powersave off
[...]
#execute video commands
[...]
and is in a computerA
but when i execute it by ssh by another computerB_terminal:
ssh pi#192.168.1.1
execute video commands work correctly in the computerA (the same where is the script)
but the command setterm works in the computerB (the terminal where i execute the ssh command).
somebody can help me with solucione it?
thank you very much!
I am not sure I understood the question:
to execute a local script, but on another machine:
scp /path/to/local/script.bash pi#192.168.1.1:/tmp/copy_of_script.bash
and then, if it's copied correctly, execute it:
ssh pi#192.168.1.1 "chmod +x /tmp/copy_of_script.bash"
ssh pi#192.168.1.1 "bash /tmp/copy_of_script.bash"
to have the remote video (Xwindows, etc) commands appear on the originating machine:
replace : ssh with : ssh -x (to allow X-Forwarding, which will allocate a DISPLAY automatically on the remote machine that will be tunneled back to the originating machine)
for the X-forwarding to work, there are some requirements (usually ok by default, but ymmv) : read more about those requirements in this Unix.se answer

Resources