Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional topic selection #64

Open
cagucor opened this issue Jan 9, 2022 · 4 comments
Open

Conditional topic selection #64

cagucor opened this issue Jan 9, 2022 · 4 comments

Comments

@cagucor
Copy link

cagucor commented Jan 9, 2022

Hi Everyone,

Is there a way to conditionally apply a topic to a certain message? For example: if an object has a field like level, then it will be published to a different topic if it is an info or warning.

@shoothzj
Copy link
Collaborator

shoothzj commented Jan 10, 2022

@SperChung-11 Could you please look at this issue, thank you :)

@SperChung-11
Copy link

hi, @cagucor. you can try filebeat.yml config as follows :

filebeat.inputs:
- type: log
  enabled: true
  paths: /var/log/message
  fields:
    log_topic: warn_topic
  include_lines: ['WARN']

- type: log
  enabled: true
  paths: /var/log/message
  fields:
    log_topic: info_topic
  include_lines: ['INFO']

#--------------------------pulsar  output ------------------------------
output.pulsar:
  enabled: true
  url: ${PULSAR_ADDRESS}
  topic: '%{[fields.log_topic]}'

@cagucor
Copy link
Author

cagucor commented Jan 12, 2022

Hi, thanks for the reply.

I tried the solution you suggested, but it does not produce the expected result. When I use that config I get a topic called '%{[fields.log_topic]}'. Is dynamic topic a feature that is enabled? I noticed issue #19 is still open and has been in backlog for a while.

producerID=1 producer_name=filebeat topic="persistent://public/default/%{[fields.log_topic]}"

@SperChung-11
Copy link

@shoothzj can you help to confirm that if #19 was solved ? both are the same questions, thanks ^.^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants