The LogDNA agent is a program that reads log files from the computer it is installed on and uploads the log data to your LogDNA account. The LogDNA agent is required to view your file-based logs in the LogDNA web app and runs quietly in the background.
There are 2 versions:
- LogDNA Agent v1 (Available for Linux, Windows, Kubernetes, MacOS)
- LogDNA Agent v2 (4/30/2020, Available for Kubernetes 1.8+)
Log in to the LogDNA app and follow the account-tailored add log sources instructions.
By default, the LogDNA agent automatically logs all .log and extensionless files located under /var/log/, but if you want to log other directories or files, you can use the commands:
#For directories: sudo logdna-agent -d "/path/to/my/logs" #For files: sudo logdna-agent -f "/path/to/my/logfile"
If you need more complex logic, you can also view and set specific logging paths (as well as use glob patterns by editing /etc/logdna.conf. For example:
logdir = /var/log,/myapp/logs/+(name1|name2).log,/etc/myapp/**/*.log
We also love the open source community, so please feel welcome to submit PRs or report any issues you find. Check out our contributing guide for more info.
Host tags allow you to group hosts automatically into dynamic host groups without having to explicitly assign a host to a group within the LogDNA web app. To use tags, ensure the agent is installed on your host and use the following command to add a tag or tags:
sudo logdna-agent -t mytag,myothertag,anothertag
You can also edit the LogDNA configuration file under /etc/logdna.conf and specify the tags there.
tags = mytag,myothertag,anothertag
Keep in mind, even if your hostname or host machine changes, as long as the agent is running with the same tags configured, that host will automatically be added to the dynamic group located under the hosts filter.
The LogDNA agent automatically uses the machine's default OS hostname. If you wish to use a different hostname, you can edit the LogDNA configuration file under /etc/logdna.conf and specify the hostname there.
hostname = mynewhostname
- LogDNA Agent does not work with Kubernetes 1.16.0 - YAML file needs to be updated
Updated 3 months ago