LogDNA Agent v1 for Linux

How it Works

The LogDNA agent authenticates using your LogDNA Ingestion Key and opens a secure web socket to LogDNA's ingestion servers. It then 'tails' for new log data and relies on the kernel to notify when there are changes to the log files and the file system.

How to install using your terminal or shell

To install the agent, use the code block below. Select the tab for your OS and copy/paste the code into your terminal or shell.

Replace the variables with specific values:

  • your organization's ingestion key
  • the paths to the specific directories from where you want to ingest logs).
echo "deb https://repo.logdna.com stable main" | sudo tee /etc/apt/sources.list.d/logdna.list
wget -O- https://repo.logdna.com/logdna.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install logdna-agent < "/dev/null" # this line needed for copy/paste
sudo logdna-agent -k <YOUR INGESTION KEY HERE> # this is your unique Ingestion Key
# /var/log is monitored/added by default (recursively), optionally add more dirs with:
# sudo logdna-agent -d /path/to/log/folders
# You can configure the agent to tag your hosts with:
# sudo logdna-agent -t mytag,myothertag
sudo update-rc.d logdna-agent defaults
sudo /etc/init.d/logdna-agent start
sudo 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
sudo yum -y install logdna-agent
sudo logdna-agent -k <YOUR INGESTION KEY HERE> # this is your unique Ingestion Key
# /var/log is monitored/added by default (recursively), optionally add more dirs with:
# sudo logdna-agent -d /path/to/log/folders
# You can configure the agent to tag your hosts with:
# sudo logdna-agent -t mytag,myothertag
sudo chkconfig logdna-agent on
sudo service logdna-agent start

📘

UI-based instructions

You can also follow the instructions within our web application UI to install and run the LogDNA agent..

How to Install From Source

Follow these instructions to run the LogDNA agent from source:

git clone https://github.com/logdna/logdna-agent.git
cd logdna-agent
npm install

# help
sudo node index.js --help

# configure
sudo node index.js -k <YOUR LOGDNA INGESTION KEY>

# this will generate a config file at: /etc/logdna.conf
# on Linux, /var/log is monitored/added by default (recursively). You can optionally specify more folders
sudo node index.js -d /path/to/log/folders -d /path/to/2nd/folder
sudo node index.js -d /var/log                            # folder only assumes *.log + extensionless files
sudo node index.js -d "/var/log/*.txt"                    # supports glob patterns
sudo node index.js -d "/var/log/**/*.txt"                 # *.txt in any subfolder
sudo node index.js -d "/var/log/**/myapp.log"             # myapp.log in any subfolder
sudo node index.js -d "/var/log/+(name1|name2).log"       # supports extended glob patterns
sudo node index.js -e /var/log/nginx/error.log            # exclude specific files from -d
sudo node index.js -f /usr/local/nginx/logs/access.log    # add specific files
sudo node index.js -t production                          # tags
sudo node index.js -t production,app1=/opt/app1           # tags for specific paths

# other commands
sudo node index.js -l                                     # show all saved options from config
sudo node index.js -l tags,key,logdir                     # show specific entries from config
sudo node index.js -u tags                                # unset tags
sudo node index.js -u tags,logdir                         # unset tags and logdir
sudo node index.js -u all                                 # unset everything except ingestion key

# start the agent
sudo node index.js

Note that when using glob patterns with index.js, you must enclose the pattern in double quotes.

Logging from Config file limitations

Our LogDNA Agent does not current support logging from the following directories even when written in the config file. We are working on a fix for this.

/var/log/pods
/var/data/kubeletlogs
/var/lib/docker
/var/log/fluentd-buffers/kubernetes

Updated 2 months ago

LogDNA Agent v1 for Linux


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.