Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jobs/loggr-forwarder-agent-windows/monit
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"executable" => "/var/vcap/packages/forwarder-agent-windows/forwarder-agent.exe",
"args" => [],
"env" => {
"AGENT_HOST" => "#{p("host")}",
"AGENT_PORT" => "#{p("port")}",
"AGENT_CA_FILE_PATH" => "#{certs_dir}/loggregator_ca.crt",
"AGENT_CERT_FILE_PATH" => "#{certs_dir}/forwarder.crt",
Expand Down
3 changes: 3 additions & 0 deletions jobs/loggr-forwarder-agent-windows/spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ packages:
- forwarder-agent-windows

properties:
host:
description: "Host the agent is serving gRPC via mTLS"
default: "127.0.0.1"
port:
description: "Port the agent is serving gRPC via mTLS"
default: 3458
Expand Down
3 changes: 3 additions & 0 deletions jobs/loggr-forwarder-agent/spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ packages:
- forwarder-agent

properties:
host:
description: "Host the agent is serving gRPC via mTLS"
default: "127.0.0.1"
port:
description: "Port the agent is serving gRPC via mTLS"
default: 3458
Expand Down
1 change: 1 addition & 0 deletions jobs/loggr-forwarder-agent/templates/bpm.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
],
},
"env" => {
"AGENT_HOST" => "#{p("host")}",
"AGENT_PORT" => "#{p("port")}",
"AGENT_CA_FILE_PATH" => "#{certs_dir}/loggregator_ca.crt",
"AGENT_CERT_FILE_PATH" => "#{certs_dir}/forwarder.crt",
Expand Down
1 change: 1 addition & 0 deletions jobs/loggr-syslog-agent-windows/monit
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"AGENT_CERT_FILE_PATH" => "#{certs_dir}/syslog_agent.crt",
"AGENT_KEY_FILE_PATH" => "#{certs_dir}/syslog_agent.key",
"AGENT_CIPHER_SUITES" => p("tls.cipher_suites").split(":").join(","),
"AGENT_HOST" => "#{p("host")}",
"AGENT_PORT" => "#{p("port")}",

"DRAIN_SKIP_CERT_VERIFY" => "#{p("drain_skip_cert_verify")}",
Expand Down
3 changes: 3 additions & 0 deletions jobs/loggr-syslog-agent-windows/spec
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ properties:
description: Whether metadata is included in structured data by default
default: true

host:
description: "Host the agent is serving gRPC via mTLS"
default: "127.0.0.1"
port:
description: "Port the agent is serving gRPC via mTLS"
default: 3458
Expand Down
3 changes: 3 additions & 0 deletions jobs/loggr-syslog-agent/spec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ properties:
binding_cache_override_url:
description: URL to use if required to override the default bosh-dns binding cache address

host:
description: "Host the agent is serving gRPC via mTLS"
default: "127.0.0.1"
port:
description: "Port the agent is serving gRPC via mTLS"
default: 3458
Expand Down
1 change: 1 addition & 0 deletions jobs/loggr-syslog-agent/templates/bpm.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"AGENT_CERT_FILE_PATH" => "#{certs_dir}/syslog_agent.crt",
"AGENT_KEY_FILE_PATH" => "#{certs_dir}/syslog_agent.key",
"AGENT_CIPHER_SUITES" => "#{p("tls.cipher_suites").split(":").join(",")}",
"AGENT_HOST" => "#{p("host")}",
"AGENT_PORT" => "#{p("port")}",
"DRAIN_SKIP_CERT_VERIFY" => "#{p("drain_skip_cert_verify")}",
"DEFAULT_DRAIN_METADATA" => "#{p("default_drain_metadata")}",
Expand Down
3 changes: 3 additions & 0 deletions jobs/loggr-udp-forwarder/spec
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ properties:
description: |
The gRPC port to forward the converted v2 envelopes to.
default: 3458
host:
description: "Host the agent uses to listen for incoming v1 (dropsonde) envelopes via UDP"
default: "127.0.0.1"
udp_port:
description: |
The port to listen for incoming v1 (dropsonde) envelopes via UDP.
Expand Down
1 change: 1 addition & 0 deletions jobs/loggr-udp-forwarder/templates/bpm.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"LOGGREGATOR_AGENT_CERT_FILE_PATH" => "#{certs_dir}/loggregator_agent.crt",
"LOGGREGATOR_AGENT_KEY_FILE_PATH" => "#{certs_dir}/loggregator_agent.key",
"LOGGREGATOR_AGENT_ADDR" => "localhost:#{p('loggregator.ingress_port')}",
"AGENT_HOST" => "#{p('host')}",
"UDP_PORT" => "#{p('udp_port')}",
"DEPLOYMENT" => "#{deployment}",
"JOB" => "#{job_name}",
Expand Down
3 changes: 3 additions & 0 deletions jobs/loggregator_agent/spec
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ properties:
grpc_port:
description: "Port the agent is listening on to receive gRPC log envelopes"
default: 3458
host:
description: "Host the agent is listening on to receive gRPC log envelopes"
default: "127.0.0.1"
zone:
description: "Availability zone where this agent is running"
default: ""
Expand Down
1 change: 1 addition & 0 deletions jobs/loggregator_agent/templates/bpm.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ has_doppler = false
"name" => "loggregator_agent",
"executable" => "/var/vcap/packages/loggregator_agent/loggregator-agent",
"env" => {
"AGENT_HOST" => "#{p("host")}",
"AGENT_PORT" => "#{p("grpc_port")}",
"AGENT_CA_FILE" => "#{certs_dir}/loggregator_ca.crt",
"AGENT_CERT_FILE" => "#{certs_dir}/loggregator_agent.crt",
Expand Down
1 change: 1 addition & 0 deletions jobs/loggregator_agent_windows/monit
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ end
"__PIPE_SYSLOG_HOST" => p('syslog_daemon_config.address'),
"__PIPE_SYSLOG_PORT" => p('syslog_daemon_config.port'),
"__PIPE_SYSLOG_TRANSPORT" => p('syslog_daemon_config.transport'),
"AGENT_HOST" => "#{p("host")}",
"AGENT_PORT" => "#{p("grpc_port")}",
"AGENT_CA_FILE" => "#{certs_dir}/loggregator_ca.crt",
"AGENT_CERT_FILE" => "#{certs_dir}/loggregator_agent.crt",
Expand Down
3 changes: 3 additions & 0 deletions jobs/loggregator_agent_windows/spec
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ properties:
grpc_port:
description: "Port the agent is listening on to receive gRPC log envelopes"
default: 3458
host:
description: "Host the agent is listening on to receive gRPC log envelopes"
default: "127.0.0.1"
zone:
description: "Availability zone where this agent is running"
default: ""
Expand Down
2 changes: 2 additions & 0 deletions src/cmd/forwarder-agent/app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
// GRPC stores the configuration for the router as a server using a PORT
// with mTLS certs and as a client.
type GRPC struct {
Host string `env:"AGENT_HOST, report"`
Port uint16 `env:"AGENT_PORT, report"`
CAFile string `env:"AGENT_CA_FILE_PATH, required, report"`
CertFile string `env:"AGENT_CERT_FILE_PATH, required, report"`
Expand Down Expand Up @@ -40,6 +41,7 @@ type Config struct {
func LoadConfig() Config {
cfg := Config{
GRPC: GRPC{
Host: "127.0.0.1",
Port: 3458,
},
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/forwarder-agent/app/forwarder_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (s *ForwarderAgent) Run() {
rx := v2.NewReceiver(diode, im, omm)

s.v2srv = v2.NewServer(
fmt.Sprintf("127.0.0.1:%d", s.grpc.Port),
fmt.Sprintf("%s:%d", s.grpc.Host, s.grpc.Port),
rx,
grpc.Creds(serverCreds),
grpc.MaxRecvMsgSize(10*1024*1024),
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/loggregator-agent/app/app_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (a *AppV2) Start() {
)
go tx.Start()

agentAddress := fmt.Sprintf("127.0.0.1:%d", a.config.GRPC.Port)
agentAddress := fmt.Sprintf("%s:%d", a.config.GRPC.Host, a.config.GRPC.Port)
log.Printf("agent v2 API started on addr %s", agentAddress)

var es envelopeSetter
Expand Down
2 changes: 2 additions & 0 deletions src/cmd/loggregator-agent/app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
// GRPC stores the configuration for the router as a server using a PORT
// with mTLS certs and as a client.
type GRPC struct {
Host string `env:"AGENT_HOST"`
Port uint16 `env:"AGENT_PORT"`
CAFile string `env:"AGENT_CA_FILE"`
CertFile string `env:"AGENT_CERT_FILE"`
Expand Down Expand Up @@ -50,6 +51,7 @@ func LoadConfig() (*Config, error) {
Port: 14824,
},
GRPC: GRPC{
Host: "127.0.0.1",
Port: 3458,
},
}
Expand Down
2 changes: 2 additions & 0 deletions src/cmd/syslog-agent/app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
// GRPC stores the configuration for the router as a server using a PORT
// with mTLS certs and as a client.
type GRPC struct {
Host string `env:"AGENT_HOST, report"`
Port int `env:"AGENT_PORT, report"`
CAFile string `env:"AGENT_CA_FILE_PATH, required, report"`
CertFile string `env:"AGENT_CERT_FILE_PATH, required, report"`
Expand Down Expand Up @@ -63,6 +64,7 @@ func LoadConfig() Config {
},
GRPC: GRPC{
Port: 3458,
Host: "127.0.0.1",
},
AggregateConnectionRefreshInterval: 1 * time.Minute,
DefaultDrainMetadata: true,
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/syslog-agent/app/syslog_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (s *SyslogAgent) Run() {

rx := v2.NewReceiver(diode, im, omm)
s.v2Srv = v2.NewServer(
fmt.Sprintf("127.0.0.1:%d", s.grpc.Port),
fmt.Sprintf("%s:%d", s.grpc.Host, s.grpc.Port),
rx,
grpc.Creds(serverCreds),
grpc.MaxRecvMsgSize(10*1024*1024),
Expand Down
6 changes: 4 additions & 2 deletions src/cmd/udp-forwarder/app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ type GRPC struct {

// Config holds the configuration for the UDP agent
type Config struct {
UseRFC3339 bool `env:"USE_RFC3339"`
UDPPort int `env:"UDP_PORT, report"`
UseRFC3339 bool `env:"USE_RFC3339"`
Host string `env:"AGENT_HOST, report"`
UDPPort int `env:"UDP_PORT, report"`
LoggregatorAgentGRPC GRPC
Deployment string `env:"DEPLOYMENT, report"`
Job string `env:"JOB, report"`
Expand All @@ -33,6 +34,7 @@ type Config struct {
// LoadConfig reads from the environment to create a Config.
func LoadConfig(log *log.Logger) Config {
cfg := Config{
Host: "127.0.0.1",
UDPPort: 3457,
LoggregatorAgentGRPC: GRPC{
Addr: "127.0.0.1:3458",
Expand Down
6 changes: 4 additions & 2 deletions src/cmd/udp-forwarder/app/udp_forwarder.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Metrics interface {

type UDPForwarder struct {
grpc GRPC
host string
udpPort int
pprofServer *http.Server
pprofPort uint16
Expand All @@ -44,6 +45,7 @@ type UDPForwarder struct {
func NewUDPForwarder(cfg Config, l *log.Logger, m Metrics) *UDPForwarder {
return &UDPForwarder{
grpc: cfg.LoggregatorAgentGRPC,
host: cfg.Host,
udpPort: cfg.UDPPort,
pprofPort: cfg.MetricsServer.PprofPort,
debugMetrics: cfg.MetricsServer.DebugMetrics,
Expand Down Expand Up @@ -97,13 +99,13 @@ func (u *UDPForwarder) Run() {
dropsondeUnmarshaller := ingress.NewUnMarshaller(w)
u.mu.Lock()
u.nr, err = ingress.NewNetworkReader(
fmt.Sprintf("127.0.0.1:%d", u.udpPort),
fmt.Sprintf("%s:%d", u.host, u.udpPort),
dropsondeUnmarshaller,
u.metrics,
)
u.mu.Unlock()
if err != nil {
u.log.Fatalf("Failed to listen on 127.0.0.1:%d: %s", u.udpPort, err)
u.log.Fatalf("Failed to listen on %s:%d: %s", u.host, u.udpPort, err)
}

go u.nr.StartReading()
Expand Down
Loading