Packetbeat Adding Output Fields from YML config file

How can I configure the packetbeat yml file to add a field "username" if an output field exists "agent.hostname" equal to a specific value?

Here's what I got so far, but unable to start service afterwards:
I've put this config under Processors, from what I've read on Elastic documentation.

  • add_fields:
    when:
    equals:
    agent.hostname: ********
    target: username
    fields:
    name: ******