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

unable to parse syslog config receiver #196

Closed
saibug opened this issue Oct 31, 2023 · 0 comments · Fixed by #197
Closed

unable to parse syslog config receiver #196

saibug opened this issue Oct 31, 2023 · 0 comments · Fixed by #197

Comments

@saibug
Copy link

saibug commented Oct 31, 2023

Hello,

I'm trying to parse template with to_nice_yaml, and my config are :

Variable content :

opromtailScrapeConfig:
      - job_name: system
        static_configs:
        - targets:
            - localhost
          labels:
            job: messages
            __path__: /var/log/syslog
      - job_name: syslog
        syslog:
          listen_address: 0.0.0.0:1514
          idle_timeout: 60s
          label_structured_data: yes
          labels:
            job: "syslog-ng"
          use_incoming_timestamp: true
        relabel_configs:
          - source_labels: ['__syslog_message_hostname']
            target_label: 'host'

Template config :


scrape_configs:
  {% if opromtailScrapeConfig is defined %}
  {{ opromtailScrapeConfig | to_nice_yaml(indent=2) | indent(2, False) }}
  {% endif %}

{% if opromtailTargetConfig is defined %}
target_config:
  {{ opromtailTargetConfig | to_nice_yaml(indent=2) | indent(2, False) }}
{% endif %}

My output is :

scrape_configs:
    - job_name: system
    static_configs:
    - labels:
        __path__: /var/log/syslog
        job: messages
      targets:
      - localhost
  - job_name: syslog
    relabel_configs:
    - source_labels:
      - __syslog_message_hostname
      target_label: host
    syslog:
      idle_timeout: 60s
      label_structured_data: true
      labels:
        job: syslog-ng
      listen_address: 0.0.0.0:1514
      use_incoming_timestamp: true

Expected behavior :

scrape_configs:
  - job_name: syslog
    syslog:
      listen_address: 0.0.0.0:1514
      idle_timeout: 60s
      label_structured_data: yes
      labels:
        job: "syslog"
    relabel_configs:
      - source_labels: ['__syslog_message_hostname']
        target_label: 'host'

Seems to befilter's issue :(

Any idea ?

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

Successfully merging a pull request may close this issue.

1 participant