How to get access to kapacitor alert fields down the pipeline?

#1

I want to use output of alert (id, Level) in the pipeline.
When I try to peek into pipeline, it has no alert-specific information:

alert()
.id(‘foo’)
.crit(lambda: TRUE)
.message(‘hello’)
|log()

All I can see is the input data into alert, but no alerts id, .Level or message.

How to get them?

#2

Ok, I found.

I need explicitly add them inside the alert:

alert()
  .warn(lambda: "x" > 0)
  .id('prophecy')
  .warn('Its a warning')
  .topic('bad_things_will_happen')
  .idTag('alert_id')
  .levelTag('level')
  .messageField('message')
|eval()
  .keep('message')

| InfluxDBOut()
      .database(' apocrypha')
      .measurement('warnings')