Eu gostaria de colocar código em um arquivo, que quando uma nova sessão é feita é invocada para todos os usuários em um sistema Debian.
/etc/profile
só é tocado por sessões de login.
Eu gostaria de colocar código em um arquivo, que quando uma nova sessão é feita é invocada para todos os usuários em um sistema Debian.
/etc/profile
só é tocado por sessões de login.
Eu tenho um arquivo que contém um monte de cron jobs:
30 * * * * someexec somefile
30 1 * * * someexec somefile
30 5 * * * someexec somefile
Eu gostaria que, quando esses trabalhos cron fossem ativados, algo na forma de "trabalho Cron someexec somfile foi iniciado" no arquivo de log, /var/log/cronjobs.log
por exemplo.
Eu não quero registrar o que esses cron jobs ecoam quando são executados, pois já consertei isso. Eu só quero registrar que os trabalhos estão ativos.
letsencrypt.service
:
[Unit]
Description=Renews letsencrypt certificates
After=network.target letsencrypt_concat_fullchain_privkey.service
[Service]
Type=oneshot
WorkingDirectory=/etc/letsencrypt/
ExecStart=/usr/bin/letsencrypt renew
Quando inicio este serviço manualmente: sudo systemctl start letsencrypt
parece que não inicia o letsencrypt_concat_fullchain_privkey.service
serviço. Eu corri sudo systemctl start letsencrypt_concat_fullchain_privkey.service
e funciona como deveria.
O que estou tentando fazer é que quando letsencrypt.service
terminar gostaria que iniciasse o letsencrypt_concat_fullchain_privkey.service
serviço.
docker ps -a
:
de09facf7c91 x/x:x "/usr/bin/supervisord" 51 minutes ago Up 24 minutes 8080/tcp development-karl
226a1b80a233 x/x:x "/usr/bin/supervisord" 2 hours ago Up About a minute 0.0.0.0:80-84->80-84/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:1988->1988/tcp, 5672/tcp haproxy
Inicie o container com isso:docker run --name development-karl -h development-karl -d x/x:x
parte do meu haproxy.cfg
:
backend karl_dev_backend
balance roundrobin
option forwardfor
server karl_dev development-karl cookie development-karl weight 1 maxconn 1024 check
Obtenha o erro nos logs do haproxy:
[ALERT] 059/222244 (683) : parsing [/etc/haproxy/haproxy.cfg:67] : 'server karl_dev' : could not resolve address 'development-karl'.
[ALERT] 059/222244 (683) : Failed to initialize server(s) addr.
Não sei porque não resolve?
https://docs.docker.com/engine/userguide/networking/#the-default-bridge-network-in-detail
:
O Docker não oferece suporte à descoberta automática de serviço na rede de ponte padrão. Se você deseja se comunicar com nomes de contêineres nessa rede de ponte padrão, deve conectar os contêineres por meio da opção legado docker run --link.
O legado é anterior à versão 1.10.
Legado: https://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/
Mais informações sobre links legados: https://docs.docker.com/engine/userguide/networking/work-with-networks/#linking-containers-without-using-user-defined-networks
Estou executando um contêiner docker com uma pilha ELK. Tudo está funcionando perfeitamente e bem. Eu gostaria de utilizar o plug-in https://www.elastic.co/guide/en/logstash/current/plugins-outputs-http.html .
Eu instalo o plugin nele:
root@elk:/# /opt/logstash/bin/plugin install logstash-output-http
Validating logstash-output-http
Installing logstash-output-http
Installation successful
/etc/logstash/conf.d/logstash.conf
arquivo de configuração principal do logstash:
input {
beats {
port => 5044
type => "logs"
}
}
filter {
grok {
match => { "message" => "\"name\":\"Error\""}
add_tag => ["error"]
}
}
output {
elasticsearch {
hosts => "localhost:9200"
sniffing => true
manage_template => false
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
document_type => "%{[@metadata][type]}"
}
if "error" in [tags] {
http {
http_method => "post"
url => "https://hooks.slack.com/services/<MY_ID>"
format => "json"
content_type => "application/json"
message => "{\"text\": \"dis is workinz\"}"
}
}
}
Eu também tentei mudar o formato no http:
...
format => "message"
...
A configuração também é testada e é válida:
root@elk:/# /opt/logstash/bin/logstash --configtest -f /etc/logstash/conf.d/logstash.conf
Configuration OK
Ambos resultam em não funcionar. Eu verifiquei duas vezes para ter certeza de que o webhook está funcionando com um teste (do contêiner do docker logstash):
curl -H "Content-Type: application/json" -X POST -d '{"text":"testing"}' https://hooks.slack.com/services/<MY_ID>
Sei que as tags estão sendo aplicadas corretamente, verificadas no Kibana. Além disso, a cláusula if também está funcionando, pois testei colocando elasticsearch
dentro dela e, de fato, apenas enviou logs com as error
tags adicionadas para elasticsearch.
Por fim, a sagrada mensagem de erro de /var/log/logstash/logstah.log
:
{: timestamp => "2016-02-25T15:55:35.926000+0000",
: message => "[HTTP Output Failure] Encountered non-200 HTTP code 200",
: response_code => 500, : url => "https://hooks.slack.com/services/<YES_THE_ACTUAL_WEBHOOK_ID_WAS_HERE>",
: event => # < LogStash::Event: 0x408e202@ metadata = {
"beat" => "filebeat", "type" => "log"
}, @accessors = # < LogStash::Util::Accessors: 0x5dc514d7@ store = {
"message" => "{\"name\":\"myapp\",\"hostname\":\"sensu-node-dev\",\"pid\":749,\"level\":50,\"err\":{\"message\":\"Cannot find module 'lol'\",\"name\":\"Error\",\"stack\":\"Error: Cannot find module 'lol'\\n at Function.Module._resolveFilename (module.js:339:15)\\n at Function.Module._load (module.js:290:25)\\n at Module.require (module.js:367:17)\\n at require (internal/module.js:16:19)\\n at Object.<anonymous> (/srv/www/dev.site/app.js:27:6)\\n at next (native)\\n at Object.<anonymous> (/srv/www/dev.site/node_modules/koa-compose/index.js:29:5)\\n at next (native)\\n at onFulfilled (/srv/www/dev.site/node_modules/co/index.js:65:19)\\n at /srv/www/dev.site/node_modules/co/index.js:54:5\",\"code\":\"MODULE_NOT_FOUND\"},\"msg\":\"Cannot find module 'lol'\",\"time\":\"2016-02-25T15:55:25.509Z\",\"v\":0}", "@version" => "1", "@timestamp" => "2016-02-25T15:55:34.004Z", "beat" => {
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "count" => 1, "fields" => nil, "input_type" => "log", "offset" => 29352, "source" => "/var/log/bunyan/myapp-info.log", "type" => "log", "host" => "sensu-node-dev", "tags" => ["beats_input_codec_plain_applied", "error"]
}, @lut = {
"@timestamp" => [{
"message" => "{\"name\":\"myapp\",\"hostname\":\"sensu-node-dev\",\"pid\":749,\"level\":50,\"err\":{\"message\":\"Cannot find module 'lol'\",\"name\":\"Error\",\"stack\":\"Error: Cannot find module 'lol'\\n at Function.Module._resolveFilename (module.js:339:15)\\n at Function.Module._load (module.js:290:25)\\n at Module.require (module.js:367:17)\\n at require (internal/module.js:16:19)\\n at Object.<anonymous> (/srv/www/dev.site/app.js:27:6)\\n at next (native)\\n at Object.<anonymous> (/srv/www/dev.site/node_modules/koa-compose/index.js:29:5)\\n at next (native)\\n at onFulfilled (/srv/www/dev.site/node_modules/co/index.js:65:19)\\n at /srv/www/dev.site/node_modules/co/index.js:54:5\",\"code\":\"MODULE_NOT_FOUND\"},\"msg\":\"Cannot find module 'lol'\",\"time\":\"2016-02-25T15:55:25.509Z\",\"v\":0}", "@version" => "1", "@timestamp" => "2016-02-25T15:55:34.004Z", "beat" => {
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "count" => 1, "fields" => nil, "input_type" => "log", "offset" => 29352, "source" => "/var/log/bunyan/myapp-info.log", "type" => "log", "host" => "sensu-node-dev", "tags" => ["beats_input_codec_plain_applied", "error"]
}, "@timestamp"], "beat" => [{
"message" => "{\"name\":\"myapp\",\"hostname\":\"sensu-node-dev\",\"pid\":749,\"level\":50,\"err\":{\"message\":\"Cannot find module 'lol'\",\"name\":\"Error\",\"stack\":\"Error: Cannot find module 'lol'\\n at Function.Module._resolveFilename (module.js:339:15)\\n at Function.Module._load (module.js:290:25)\\n at Module.require (module.js:367:17)\\n at require (internal/module.js:16:19)\\n at Object.<anonymous> (/srv/www/dev.site/app.js:27:6)\\n at next (native)\\n at Object.<anonymous> (/srv/www/dev.site/node_modules/koa-compose/index.js:29:5)\\n at next (native)\\n at onFulfilled (/srv/www/dev.site/node_modules/co/index.js:65:19)\\n at /srv/www/dev.site/node_modules/co/index.js:54:5\",\"code\":\"MODULE_NOT_FOUND\"},\"msg\":\"Cannot find module 'lol'\",\"time\":\"2016-02-25T15:55:25.509Z\",\"v\":0}", "@version" => "1", "@timestamp" => "2016-02-25T15:55:34.004Z", "beat" => {
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "count" => 1, "fields" => nil, "input_type" => "log", "offset" => 29352, "source" => "/var/log/bunyan/myapp-info.log", "type" => "log", "host" => "sensu-node-dev", "tags" => ["beats_input_codec_plain_applied", "error"]
}, "beat"], "count" => [{
"message" => "{\"name\":\"myapp\",\"hostname\":\"sensu-node-dev\",\"pid\":749,\"level\":50,\"err\":{\"message\":\"Cannot find module 'lol'\",\"name\":\"Error\",\"stack\":\"Error: Cannot find module 'lol'\\n at Function.Module._resolveFilename (module.js:339:15)\\n at Function.Module._load (module.js:290:25)\\n at Module.require (module.js:367:17)\\n at require (internal/module.js:16:19)\\n at Object.<anonymous> (/srv/www/dev.site/app.js:27:6)\\n at next (native)\\n at Object.<anonymous> (/srv/www/dev.site/node_modules/koa-compose/index.js:29:5)\\n at next (native)\\n at onFulfilled (/srv/www/dev.site/node_modules/co/index.js:65:19)\\n at /srv/www/dev.site/node_modules/co/index.js:54:5\",\"code\":\"MODULE_NOT_FOUND\"},\"msg\":\"Cannot find module 'lol'\",\"time\":\"2016-02-25T15:55:25.509Z\",\"v\":0}", "@version" => "1", "@timestamp" => "2016-02-25T15:55:34.004Z", "beat" => {
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "count" => 1, "fields" => nil, "input_type" => "log", "offset" => 29352, "source" => "/var/log/bunyan/myapp-info.log", "type" => "log", "host" => "sensu-node-dev", "tags" => ["beats_input_codec_plain_applied", "error"]
}, "count"], "fields" => [{
"message" => "{\"name\":\"myapp\",\"hostname\":\"sensu-node-dev\",\"pid\":749,\"level\":50,\"err\":{\"message\":\"Cannot find module 'lol'\",\"name\":\"Error\",\"stack\":\"Error: Cannot find module 'lol'\\n at Function.Module._resolveFilename (module.js:339:15)\\n at Function.Module._load (module.js:290:25)\\n at Module.require (module.js:367:17)\\n at require (internal/module.js:16:19)\\n at Object.<anonymous> (/srv/www/dev.site/app.js:27:6)\\n at next (native)\\n at Object.<anonymous> (/srv/www/dev.site/node_modules/koa-compose/index.js:29:5)\\n at next (native)\\n at onFulfilled (/srv/www/dev.site/node_modules/co/index.js:65:19)\\n at /srv/www/dev.site/node_modules/co/index.js:54:5\",\"code\":\"MODULE_NOT_FOUND\"},\"msg\":\"Cannot find module 'lol'\",\"time\":\"2016-02-25T15:55:25.509Z\",\"v\":0}", "@version" => "1", "@timestamp" => "2016-02-25T15:55:34.004Z", "beat" => {
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "count" => 1, "fields" => nil, "input_type" => "log", "offset" => 29352, "source" => "/var/log/bunyan/myapp-info.log", "type" => "log", "host" => "sensu-node-dev", "tags" => ["beats_input_codec_plain_applied", "error"]
}, "fields"], "input_type" => [{
"message" => "{\"name\":\"myapp\",\"hostname\":\"sensu-node-dev\",\"pid\":749,\"level\":50,\"err\":{\"message\":\"Cannot find module 'lol'\",\"name\":\"Error\",\"stack\":\"Error: Cannot find module 'lol'\\n at Function.Module._resolveFilename (module.js:339:15)\\n at Function.Module._load (module.js:290:25)\\n at Module.require (module.js:367:17)\\n at require (internal/module.js:16:19)\\n at Object.<anonymous> (/srv/www/dev.site/app.js:27:6)\\n at next (native)\\n at Object.<anonymous> (/srv/www/dev.site/node_modules/koa-compose/index.js:29:5)\\n at next (native)\\n at onFulfilled (/srv/www/dev.site/node_modules/co/index.js:65:19)\\n at /srv/www/dev.site/node_modules/co/index.js:54:5\",\"code\":\"MODULE_NOT_FOUND\"},\"msg\":\"Cannot find module 'lol'\",\"time\":\"2016-02-25T15:55:25.509Z\",\"v\":0}", "@version" => "1", "@timestamp" => "2016-02-25T15:55:34.004Z", "beat" => {
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "count" => 1, "fields" => nil, "input_type" => "log", "offset" => 29352, "source" => "/var/log/bunyan/myapp-info.log", "type" => "log", "host" => "sensu-node-dev", "tags" => ["beats_input_codec_plain_applied", "error"]
}, "input_type"], "offset" => [{
"message" => "{\"name\":\"myapp\",\"hostname\":\"sensu-node-dev\",\"pid\":749,\"level\":50,\"err\":{\"message\":\"Cannot find module 'lol'\",\"name\":\"Error\",\"stack\":\"Error: Cannot find module 'lol'\\n at Function.Module._resolveFilename (module.js:339:15)\\n at Function.Module._load (module.js:290:25)\\n at Module.require (module.js:367:17)\\n at require (internal/module.js:16:19)\\n at Object.<anonymous> (/srv/www/dev.site/app.js:27:6)\\n at next (native)\\n at Object.<anonymous> (/srv/www/dev.site/node_modules/koa-compose/index.js:29:5)\\n at next (native)\\n at onFulfilled (/srv/www/dev.site/node_modules/co/index.js:65:19)\\n at /srv/www/dev.site/node_modules/co/index.js:54:5\",\"code\":\"MODULE_NOT_FOUND\"},\"msg\":\"Cannot find module 'lol'\",\"time\":\"2016-02-25T15:55:25.509Z\",\"v\":0}", "@version" => "1", "@timestamp" => "2016-02-25T15:55:34.004Z", "beat" => {
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "count" => 1, "fields" => nil, "input_type" => "log", "offset" => 29352, "source" => "/var/log/bunyan/myapp-info.log", "type" => "log", "host" => "sensu-node-dev", "tags" => ["beats_input_codec_plain_applied", "error"]
}, "offset"], "source" => [{
"message" => "{\"name\":\"myapp\",\"hostname\":\"sensu-node-dev\",\"pid\":749,\"level\":50,\"err\":{\"message\":\"Cannot find module 'lol'\",\"name\":\"Error\",\"stack\":\"Error: Cannot find module 'lol'\\n at Function.Module._resolveFilename (module.js:339:15)\\n at Function.Module._load (module.js:290:25)\\n at Module.require (module.js:367:17)\\n at require (internal/module.js:16:19)\\n at Object.<anonymous> (/srv/www/dev.site/app.js:27:6)\\n at next (native)\\n at Object.<anonymous> (/srv/www/dev.site/node_modules/koa-compose/index.js:29:5)\\n at next (native)\\n at onFulfilled (/srv/www/dev.site/node_modules/co/index.js:65:19)\\n at /srv/www/dev.site/node_modules/co/index.js:54:5\",\"code\":\"MODULE_NOT_FOUND\"},\"msg\":\"Cannot find module 'lol'\",\"time\":\"2016-02-25T15:55:25.509Z\",\"v\":0}", "@version" => "1", "@timestamp" => "2016-02-25T15:55:34.004Z", "beat" => {
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "count" => 1, "fields" => nil, "input_type" => "log", "offset" => 29352, "source" => "/var/log/bunyan/myapp-info.log", "type" => "log", "host" => "sensu-node-dev", "tags" => ["beats_input_codec_plain_applied", "error"]
}, "source"], "type" => [{
"message" => "{\"name\":\"myapp\",\"hostname\":\"sensu-node-dev\",\"pid\":749,\"level\":50,\"err\":{\"message\":\"Cannot find module 'lol'\",\"name\":\"Error\",\"stack\":\"Error: Cannot find module 'lol'\\n at Function.Module._resolveFilename (module.js:339:15)\\n at Function.Module._load (module.js:290:25)\\n at Module.require (module.js:367:17)\\n at require (internal/module.js:16:19)\\n at Object.<anonymous> (/srv/www/dev.site/app.js:27:6)\\n at next (native)\\n at Object.<anonymous> (/srv/www/dev.site/node_modules/koa-compose/index.js:29:5)\\n at next (native)\\n at onFulfilled (/srv/www/dev.site/node_modules/co/index.js:65:19)\\n at /srv/www/dev.site/node_modules/co/index.js:54:5\",\"code\":\"MODULE_NOT_FOUND\"},\"msg\":\"Cannot find module 'lol'\",\"time\":\"2016-02-25T15:55:25.509Z\",\"v\":0}", "@version" => "1", "@timestamp" => "2016-02-25T15:55:34.004Z", "beat" => {
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "count" => 1, "fields" => nil, "input_type" => "log", "offset" => 29352, "source" => "/var/log/bunyan/myapp-info.log", "type" => "log", "host" => "sensu-node-dev", "tags" => ["beats_input_codec_plain_applied", "error"]
}, "type"], "[beat][hostname]" => [{
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "hostname"], "host" => [{
"message" => "{\"name\":\"myapp\",\"hostname\":\"sensu-node-dev\",\"pid\":749,\"level\":50,\"err\":{\"message\":\"Cannot find module 'lol'\",\"name\":\"Error\",\"stack\":\"Error: Cannot find module 'lol'\\n at Function.Module._resolveFilename (module.js:339:15)\\n at Function.Module._load (module.js:290:25)\\n at Module.require (module.js:367:17)\\n at require (internal/module.js:16:19)\\n at Object.<anonymous> (/srv/www/dev.site/app.js:27:6)\\n at next (native)\\n at Object.<anonymous> (/srv/www/dev.site/node_modules/koa-compose/index.js:29:5)\\n at next (native)\\n at onFulfilled (/srv/www/dev.site/node_modules/co/index.js:65:19)\\n at /srv/www/dev.site/node_modules/co/index.js:54:5\",\"code\":\"MODULE_NOT_FOUND\"},\"msg\":\"Cannot find module 'lol'\",\"time\":\"2016-02-25T15:55:25.509Z\",\"v\":0}", "@version" => "1", "@timestamp" => "2016-02-25T15:55:34.004Z", "beat" => {
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "count" => 1, "fields" => nil, "input_type" => "log", "offset" => 29352, "source" => "/var/log/bunyan/myapp-info.log", "type" => "log", "host" => "sensu-node-dev", "tags" => ["beats_input_codec_plain_applied", "error"]
}, "host"], "tags" => [{
"message" => "{\"name\":\"myapp\",\"hostname\":\"sensu-node-dev\",\"pid\":749,\"level\":50,\"err\":{\"message\":\"Cannot find module 'lol'\",\"name\":\"Error\",\"stack\":\"Error: Cannot find module 'lol'\\n at Function.Module._resolveFilename (module.js:339:15)\\n at Function.Module._load (module.js:290:25)\\n at Module.require (module.js:367:17)\\n at require (internal/module.js:16:19)\\n at Object.<anonymous> (/srv/www/dev.site/app.js:27:6)\\n at next (native)\\n at Object.<anonymous> (/srv/www/dev.site/node_modules/koa-compose/index.js:29:5)\\n at next (native)\\n at onFulfilled (/srv/www/dev.site/node_modules/co/index.js:65:19)\\n at /srv/www/dev.site/node_modules/co/index.js:54:5\",\"code\":\"MODULE_NOT_FOUND\"},\"msg\":\"Cannot find module 'lol'\",\"time\":\"2016-02-25T15:55:25.509Z\",\"v\":0}", "@version" => "1", "@timestamp" => "2016-02-25T15:55:34.004Z", "beat" => {
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "count" => 1, "fields" => nil, "input_type" => "log", "offset" => 29352, "source" => "/var/log/bunyan/myapp-info.log", "type" => "log", "host" => "sensu-node-dev", "tags" => ["beats_input_codec_plain_applied", "error"]
}, "tags"], "message" => [{
"message" => "{\"name\":\"myapp\",\"hostname\":\"sensu-node-dev\",\"pid\":749,\"level\":50,\"err\":{\"message\":\"Cannot find module 'lol'\",\"name\":\"Error\",\"stack\":\"Error: Cannot find module 'lol'\\n at Function.Module._resolveFilename (module.js:339:15)\\n at Function.Module._load (module.js:290:25)\\n at Module.require (module.js:367:17)\\n at require (internal/module.js:16:19)\\n at Object.<anonymous> (/srv/www/dev.site/app.js:27:6)\\n at next (native)\\n at Object.<anonymous> (/srv/www/dev.site/node_modules/koa-compose/index.js:29:5)\\n at next (native)\\n at onFulfilled (/srv/www/dev.site/node_modules/co/index.js:65:19)\\n at /srv/www/dev.site/node_modules/co/index.js:54:5\",\"code\":\"MODULE_NOT_FOUND\"},\"msg\":\"Cannot find module 'lol'\",\"time\":\"2016-02-25T15:55:25.509Z\",\"v\":0}", "@version" => "1", "@timestamp" => "2016-02-25T15:55:34.004Z", "beat" => {
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "count" => 1, "fields" => nil, "input_type" => "log", "offset" => 29352, "source" => "/var/log/bunyan/myapp-info.log", "type" => "log", "host" => "sensu-node-dev", "tags" => ["beats_input_codec_plain_applied", "error"]
}, "message"], "[tags]" => [{
"message" => "{\"name\":\"myapp\",\"hostname\":\"sensu-node-dev\",\"pid\":749,\"level\":50,\"err\":{\"message\":\"Cannot find module 'lol'\",\"name\":\"Error\",\"stack\":\"Error: Cannot find module 'lol'\\n at Function.Module._resolveFilename (module.js:339:15)\\n at Function.Module._load (module.js:290:25)\\n at Module.require (module.js:367:17)\\n at require (internal/module.js:16:19)\\n at Object.<anonymous> (/srv/www/dev.site/app.js:27:6)\\n at next (native)\\n at Object.<anonymous> (/srv/www/dev.site/node_modules/koa-compose/index.js:29:5)\\n at next (native)\\n at onFulfilled (/srv/www/dev.site/node_modules/co/index.js:65:19)\\n at /srv/www/dev.site/node_modules/co/index.js:54:5\",\"code\":\"MODULE_NOT_FOUND\"},\"msg\":\"Cannot find module 'lol'\",\"time\":\"2016-02-25T15:55:25.509Z\",\"v\":0}", "@version" => "1", "@timestamp" => "2016-02-25T15:55:34.004Z", "beat" => {
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "count" => 1, "fields" => nil, "input_type" => "log", "offset" => 29352, "source" => "/var/log/bunyan/myapp-info.log", "type" => "log", "host" => "sensu-node-dev", "tags" => ["beats_input_codec_plain_applied", "error"]
}, "tags"]
} > , @data = {
"message" => "{\"name\":\"myapp\",\"hostname\":\"sensu-node-dev\",\"pid\":749,\"level\":50,\"err\":{\"message\":\"Cannot find module 'lol'\",\"name\":\"Error\",\"stack\":\"Error: Cannot find module 'lol'\\n at Function.Module._resolveFilename (module.js:339:15)\\n at Function.Module._load (module.js:290:25)\\n at Module.require (module.js:367:17)\\n at require (internal/module.js:16:19)\\n at Object.<anonymous> (/srv/www/dev.site/app.js:27:6)\\n at next (native)\\n at Object.<anonymous> (/srv/www/dev.site/node_modules/koa-compose/index.js:29:5)\\n at next (native)\\n at onFulfilled (/srv/www/dev.site/node_modules/co/index.js:65:19)\\n at /srv/www/dev.site/node_modules/co/index.js:54:5\",\"code\":\"MODULE_NOT_FOUND\"},\"msg\":\"Cannot find module 'lol'\",\"time\":\"2016-02-25T15:55:25.509Z\",\"v\":0}", "@version" => "1", "@timestamp" => "2016-02-25T15:55:34.004Z", "beat" => {
"hostname" => "sensu-node-dev", "name" => "sensu-node-dev"
}, "count" => 1, "fields" => nil, "input_type" => "log", "offset" => 29352, "source" => "/var/log/bunyan/myapp-info.log", "type" => "log", "host" => "sensu-node-dev", "tags" => ["beats_input_codec_plain_applied", "error"]
}, @metadata_accessors = # < LogStash::Util::Accessors: 0x22cd112d@ store = {
"beat" => "filebeat", "type" => "log"
}, @lut = {
"[type]" => [{
"beat" => "filebeat", "type" => "log"
}, "type"], "[beat]" => [{
"beat" => "filebeat", "type" => "log"
}, "beat"]
} > , @cancelled = false > , : level => : error
}
Como você pode ver, indica response_code => 500
erro interno. Eu recebo o mesmo erro com ambos format => "json"
e format => "message"
.
Eu estou supondo que tem algo a ver com minha configuração (obviamente).
Como se obtém a versão do Logstash?
root@elk:/usr/share/elasticsearch# bin/logstash --help
bash: bin/logstash: No such file or directory
Eu tenho o Logstash em execução no meu sistema. Também.
root@elk:/# logstash -V
bash: logstash: command not found
Também.
root@elk:/# ps aux | grep logstash
logstash 1725 45.3 8.5 1942860 175936 ? SNl 22:03 0:35 /usr/bin/java -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -Djava.awt.headless=true -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/opt/logstash -Xmx500m -Xss2048k -Djffi.boot.library.path=/opt/logstash/vendor/jruby/lib/jni -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -Djava.awt.headless=true -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/opt/logstash -XX:HeapDumpPath=/opt/logstash/heapdump.hprof -Xbootclasspath/a:/opt/logstash/vendor/jruby/lib/jruby.jar -classpath : -Djruby.home=/opt/logstash/vendor/jruby -Djruby.lib=/opt/logstash/vendor/jruby/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main --1.9 /opt/logstash/lib/bootstrap/environment.rb logstash/runner.rb agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log
root 1777 0.0 0.0 8860 636 ? S+ 22:05 0:00 grep --color=auto logstash
Mais.
root@elk:/opt/logstash/bin# ls
logstash logstash.bat logstash.lib.sh plugin plugin.bat rspec rspec.bat setup.bat
root@elk:/opt/logstash/bin# logstash -V
bash: logstash: command not found
docker run -d -v /srv/dockervolume/openssh-git/srv:/srv --name node-basickarl -h node-basickarl basickarl/node-basickarl
ping:
root@domain:/srv/dockervolume/haproxy/etc/haproxy# ping node-basickarl
ping: unknown host node-basickarl
Funciona quando faço ping no endereço ipv4. Por que o nome do host não está funcionando?
Eu recebo o erro:
[ALERT] 342/125339 (1) : sendmsg logger #1 failed: No such file or directory (errno=2)
/srv/dockervolume/haproxy/etc/rsyslog.d/49-haproxy.conf arquivo:
$AddUnixListenSocket /var/lib/haproxy/dev/log
local0.* -/var/log/haproxy/haproxy_0.log
local1.* -/var/log/haproxy/haproxy_1.log
if ($programname == 'haproxy') then -/var/log/haproxy/haproxy.log
& ~
/srv/dockervolume/haproxy/etc/haproxy/haproxy.cfg arquivo:
global
log /var/lib/haproxy/dev/log local0 debug
chroot /var/lib/haproxy
maxconn 2048
tune.ssl.default-dh-param 2048
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
defaults
log global
mode http
option httplog
option dontlognull
retries 3
timeout connect 5000
timeout client 10000
timeout server 10000
backend my_backend
log /var/lib/haproxy/dev/log local0 debug
rsyslog está em execução:
root@haproxy:/# ps aux | grep rsys
syslog 37 0.0 0.0 116572 1876 ? Sl+ 12:57 0:00 rsyslogd -n -c5
E haproxy está funcionando bem de outra forma!
[supervisord]
nodaemon=true
[program:haproxy]
command=service haproxy start
numprocs=1
autostart=true
autorestart=true
O arquivo conf está criando quatro instâncias. Alguma ideia de por que isso está acontecendo?
root@haproxy:/etc/init.d# ps aux | grep haproxy
haproxy 18 0.0 1.1 39436 5760 ? Ss 15:42 0:00 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -D -p /var/run/haproxy.pid
haproxy 27 0.0 1.3 39572 6944 ? Ss 15:42 0:00 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -D -p /var/run/haproxy.pid
haproxy 36 0.0 1.1 39436 5768 ? Ss 15:42 0:00 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -D -p /var/run/haproxy.pid
haproxy 45 0.0 1.1 39436 5768 ? Ss 15:42 0:00 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -D -p /var/run/haproxy.pid
root 69 0.0 0.1 8860 648 ? S+ 15:53 0:00 grep --color=auto haproxy
Eu vi isso em outro tópico que resolveu atrasar o início de um processo no supervisord (atrasado 5 segundos):
command=bash -c 'sleep 5 && uwsgi /etc/uwsgi.ini'
Como alguém faria isso para fazer o seguinte:
command=service haproxy start
meu /etc/supervisor/conf.d/supervisord.conf
:
[supervisord]
nodaemon=true
[program:rsyslog]
command=service rsyslog start
startsecs 5
autostart=true
autorestart=true
Eu recebo o erro:
root@haproxy:/# /usr/bin/supervisord
/usr/lib/python2.7/dist-packages/supervisor/options.py:295: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
'Supervisord is running as root and it is searching '
Error: File contains parsing errors: /etc/supervisor/conf.d/supervisord.conf
[line 6]: 'startsecs 5\n'
For help, use /usr/bin/supervisord -h
Eu tenho tentado fazer com que esses dois iniciem quando minha imagem do docker é iniciada, mas eles nunca parecem iniciar.
[supervisord]
nodaemon=true
[program:rsyslog]
command=/bin/bash "service rsyslog start"
[program:haproxy]
command=/bin/bash "service haproxy start"
Qual comando é necessário para iniciar ambos na ordem de rsyslog primeiro e depois haproxy?
Estou executando o Ubuntu 14.04 e gostaria de saber como posso registrar tudo o que acontece no HAProxy. Eu tenho lido questões sobre log e chroot. Tudo está me dizendo para escrever coisas diferentes em arquivos diferentes.
/var/log# ls
alternatives.log apt bootstrap.log btmp dmesg dpkg.log faillog fsck lastlog upstart wtmp
/etc/rsyslog.d# ls
49-haproxy.conf 50-default.conf
Meu /etc/haproxy/haproxy.cfg
arquivo contém isso:
global
log 127.0.0.1 local0
maxconn 2048
tune.ssl.default-dh-param 2048
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
defaults
log global
mode http
option httplog
option dontlognull
retries 3
timeout connect 5000
timeout client 10000
timeout server 10000
Não consigo ver nenhum log em lugar nenhum!
Eu recebo o erro:
(error) NOAUTH Authentication required.
Ao redis-cli
entrar e tentar exibir o arquivo KEYS *
. Eu só configurei um requirepass
não auth
afaiac. Estou no redis.conf
mas não sei o que fazer.
Eu tenho um servidor. Neste servidor, tenho um contêiner haproxy, contêineres de nó 2x. Estou tentando dividir o seguinte.
https://mydomain -> 1e node container (x.x.x.x:8080)
https://mydomain:81 -> 2e node container (x.x.x.x:8080)
Minha configuração:
global
log 127.0.0.1 local0 notice
maxconn 2048
tune.ssl.default-dh-param 2048
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
defaults
log global
mode http
option httplog
option dontlognull
retries 3
timeout connect 5000
timeout client 10000
timeout server 10000
listen stats
bind *:1988 ssl crt /srv/ssl.io.pem
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /haproxy
stats auth myuser:mypassword
frontend http-in-beta
bind *:81 ssl crt /srv/ssl.io.pem
acl host_mydomain_com_beta hdr_beg(host) -i mydomain.com
use_backend mydomain_beta if host_mydomain_com_beta
frontend http-in
bind *:80
redirect scheme https code 301 if !{ ssl_fc } # redirect all traffic to https
frontend https-in
bind *:443 ssl crt /srv/ssl.io.pem
acl host_mydomain_com hdr_beg(host) -i mydomain.com
use_backend mydomain_cluster if host_mydomain_com
backend mydomain_beta
balance roundrobin
option forwardfor
server mydomain_beta 172.17.0.110:8080
backend mydomain_cluster
balance roundrobin
option forwardfor
server mydomain_node_s1 172.17.0.109:8080
Agora, o problema que estou recebendo é que às vezes funciona. Às vezes recebo um 503. É frustrante!
Parece que as portas 81 e 80 estão de alguma forma colidindo?
docker run -it -p 8080 myimage /bin/bash
Eu esperaria que o código acima expusesse a porta 8080 privada. Porém quando executo:
docker ps -a
Isto mostra:
0.0.0.0:32770->8080/tcp
Como definir a porta 8080 para expor apenas privada?
global
log 127.0.0.1 local0 notice
maxconn 2048
tune.ssl.default-dh-param 2048
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
defaults
log global
mode http
option httplog
option dontlognull
retries 3
timeout connect 5000
timeout client 10000
timeout server 10000
listen stats
bind *:1988 ssl crt /srv/mypem.pem
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /haproxy
stats auth user:password
frontend http-in
bind *:80
redirect scheme https code 301 if !{ ssl_fc } # redirect all traffic to https
frontend https-in
bind *:443 ssl crt /srv/mypem.pem
acl host_mydomain_com hdr_beg(host) -i mydomain.com
use_backend mydomain_cluster if host_mydomain_com
backend mydomain_cluster
balance leastconn
option forwardfor
server s1 x.x.x.x:8080
Não consigo exibir a página de estatísticas no HAProxy. Acima está a minha configuração.
Estou tentando criar uma imagem que contém um servidor openssh e iniciá-lo ao invocar o comando run. Eu fiz os seguintes passos:
docker pull ubuntu
docker run -d -it ubuntu bash
apt-get update
apt-get install openssh-server -y
exit
docker ps -a
docker commit <CONTAINER ID> myimg
// tried the following three, same results
docker run -d myimg "/usr/sbin/sshd"
docker run -d myimg /usr/sbin/sshd -D
docker run -d myimg service ssh start
Isso executa a imagem e sai imediatamente, estou tentando fazer o serviço acompanhar. O que estou fazendo errado?
Desejo usar Gmail
para lidar com todas as minhas necessidades de e-mail. Enviando, lendo, excluindo, movendo, encaminhando etc. Eu tenho um domínio com um e-mail em Zoho
[email protected]
, está funcionando bem.
Sempre fiquei confuso sobre POP3
qual IMAP
servidor/cliente faz o quê. Leitura Qual é a diferença entre POP3 e IMAP para e-mail? realmente não me deixou mais inteligente.
Aqui está um fluxo do e-mail do [email protected]
qual eu gostaria:
E-mail de entrada (para: [email protected]) -> caixa de entrada Zoho ([email protected]) -> conta do Gmail ([email protected]) -> cliente Android/navegador da Web
Também gostaria de enviar:
Cliente Android/navegador da Web -> Conta do Gmail(usuá[email protected]) -> Conta Zoho(usuário@meudomínio.com) -> Enviar e-mail(de: usuário@meudomínio.com)
Também gostaria de configurar para que via Gmail eu possa enviar e-mails via [email protected]
.
Você pode dizer que Gmail
é central. Como eu configuraria isso? Eu estou supondo que é melhor usar IMAP
como POP3
está velho. Também gostaria de manter cópias Zoho
que não sejam afetadas pelo Gmail, portanto, se eu excluir uma mensagem no Gmail que foi para [email protected]
ela, não será excluída Zoho
(use Zoho
como backup).
Qual deve ser o IMAP
/ POP3
server neste caso?
POP
Detalhes da configuração:
IMAP
Detalhes da configuração:
Servidor de entrada de correio ( IMAP
) - requer SSL
Servidor de e- mail de saída ( SMTP
) - requer TLS
Estou usando o docker com alguns contêineres. Um dos meus contêineres tem haproxy e desejo reverter o proxy de um domínio para um dos outros contêineres que contém um servidor da web.
Há algumas coisas estranhas acontecendo. A primeira é a versão do haproxy e a página de status.
haproxy --version
HA-Proxy version 1.5.12 2015/05/02
Copyright 2000-2015 Willy Tarreau <[email protected]>
Quando entro em mydomain.com
um desses dois, aparece aleatoriamente:
Ou:
A imagem inferior tem mais informações, mas ainda informa a versão errada?
Aqui está o meu /etc/haproxy/haproxy.cfg
arquivo:
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
frontend http-in
bind *:80
# Define hosts
acl host_mydomain hdr(host) -i mydomain.com
## figure out which one to use
use_backend mydomain_cluster if host_mydomain
backend mydomain_cluster
balance leastconn
option httpclose
option forwardfor
cookie JSESSIONID prefix
server node1 172.17.0.42:8080 cookie A check
O 172.17.0.42
é o endereço IP do contêiner do servidor da Web com sua porta 8080
.