0

我正在将 LogDNA 与 Elastic beanstalk 集成。我已经添加了配置文件,如下所示:

files:
  "/home/ec2-user/logdna.sh" :
    mode: "000777"
    owner: root
    group: root
    content: |
        #!/bin/sh
        rpm --import https://repo.logdna.com/logdna.gpg
        echo "[logdna]
        name=LogDNA packages
        baseurl=https://repo.logdna.com/el6/
        enabled=1
        gpgcheck=1
        gpgkey=https://repo.logdna.com/logdna.gpg" | sudo tee /etc/yum.repos.d/logdna.repo
        yum -y install logdna-agent
        logdna-agent -k <INGESTION_KEY> # this is your unique Ingestion Key
        # /var/log is monitored/added by default (recursively), optionally add more dirs here
        logdna-agent -d /var/path/log
        # logdna-agent --hostname allows you to pass your AWS env metadata to LogDNA (remove # to uncomment the line below)
        # logdna-agent --hostname `{"Ref": "AWSEBEnvironmentName" }`
        # logdna -t option allows you to tag the host with tags (remove # to uncomment the line below)
        #logdna-agent -t `{"Ref": "AWSEBEnvironmentName" }`
        chkconfig logdna-agent on
        service logdna-agent start
commands:
  01_install_logdna:
    command: "/home/ec2-user/logdna.sh"
  02_restart_logdna:
    command: "service logdna-agent restart"

我知道我可以通过执行 `logdna-agent -d /path/log-to-be-monitored 添加要监视的特定文件

但在我自己的场景中,我不想流式传输或监控所有来源的日志。我只想捕获/监视来自特定路由的日志`/api.

我只想监视/捕获这条路线的日志或数据。我如何使用 LogDNA 代理来做到这一点?

4

0 回答 0