Skip to content

Example: Socket Counter Stats (WIP)

Lorenzo Mangani edited this page Mar 30, 2020 · 1 revision
sudo npm install -g @pastash/pastash @pastash/output_influxdb
input {
  udp {
    host => 127.0.0.1
    port => 9060
    type => 'socket1'
  }
  udp {
    host => 127.0.0.1
    port => 9061
    type => 'socket2'
  }
}

filter {
  tinymath {
    target_field => "packetcounter"
    expression => "1"
  }
}

output {
  if [type] = "socket1" {
    influxdb {
      database => hepstats
      host => localhost
      port => 8086
      protocol => udp
      tags => {'socket1'}
      metric_type => counter
      metric_key => packetcounter
    }
  }
  if [type] = "socket2" {
    influxdb {
      database => hepstats
      host => localhost
      port => 8086
      protocol => udp
      tags => {'socket2'}
      metric_type => counter
      metric_key => packetcounter
    }
  }
}
Clone this wiki locally