Skip to content

Example: File to MQTT

Lorenzo Mangani edited this page Mar 8, 2022 · 2 revisions

MQTT

PaStash natively support MQTT (or Mosquitto) a high-performance asynchronous messaging library, aimed at use in distributed or concurrent applications without a dedicated message broker.

Setup

# npm install -g @pastash/pastash @pastash/output_mqtt @pastash/input_mqtt

Log Agent(s)

input {
  file {
    path => "/var/log/nginx/access.log"
  }
}

output {
  mqtt {
    address => ["mqtt://broker.hivemq.com"]
    topic => pastash
  }
}

Log Server

input {
 mqtt {
    address => ["mqtt://broker.hivemq.com"]
    topic => pastash
  }
}

output {
  loki {
    host => localhost
    port => 3100
    path => "/loki/api/v1/push"
  }
}
Clone this wiki locally