{"_id":"5771a60c01e8110e0041acf0","project":"56ba46e2ce5d540d00e2d7a7","version":{"_id":"56ba46e2ce5d540d00e2d7aa","project":"56ba46e2ce5d540d00e2d7a7","__v":12,"createdAt":"2016-02-09T20:06:58.727Z","releaseDate":"2016-02-09T20:06:58.727Z","categories":["56ba46e3ce5d540d00e2d7ab","5771a6b145c7080e0072927f","5771a72eb0ea6b0e006a5221","5772e5b20a6d610e00dea073","577c3006b20f211700593629","57ae587bca3e310e00538155","57ae593a7c93fa0e001e6b50","57b1f8263ff6c519005cf074","582601f155b1060f00ec4173","582a62857a96051b0070b011","58ebfae58d5a860f00851fb9","590a75a1ec0d5e190095ab38"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"582a62857a96051b0070b011","__v":0,"version":"56ba46e2ce5d540d00e2d7aa","project":"56ba46e2ce5d540d00e2d7a7","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-11-15T01:19:01.988Z","from_sync":false,"order":3,"slug":"tools","title":"Tools"},"parentDoc":null,"user":"5732062ad720220e008ea1d2","__v":18,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-06-27T22:17:48.213Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"##What is the LogDNA agent?\n\nThe 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.\n\n##How do I install the LogDNA agent?\n\nLog in to [the LogDNA app](https://app.logdna.com/pages/add-host) and follow the [account-tailored add log sources instructions](https://app.logdna.com/pages/add-host).\n\n##How do I tell the LogDNA agent what to log?\n\nBy 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:\n\n```\n#For directories:\nsudo logdna-agent -d \"/path/to/my/logs\"\n#For files:\nsudo logdna-agent -f \"/path/to/my/logfile\"\n```\n\nIf you need more complex logic, you can also view and set specific logging paths (as well as use [glob patterns](https://en.wikipedia.org/wiki/Glob_(programming)) by editing **/etc/logdna.conf**. For example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"logdir = /var/log,/myapp/logs/+(name1|name2).log,/etc/myapp/**/*.log\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n##Can I trust the LogDNA agent?\n\nAbsolutely! But if you ever want to double check, you can [view the source code on GitHub](https://github.com/logdna/logdna-agent) and even build the agent yourself. If you have any questions or feedback, email us at support:::at:::logdna.com. \n\nWe also love the open source community, so please feel welcome to submit PRs or report any issues you find. Check out our [contributing guide](https://github.com/logdna/logdna-agent/blob/master/CONTRIBUTING.md) for more info.\n\n## How do I use host tags?\n\nHost 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:\n\n```\nsudo logdna-agent -t mytag,myothertag,anothertag\n```\nYou can also edit the LogDNA configuration file under /etc/logdna.conf and specify the tags there.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"tags = mytag,myothertag,anothertag\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nKeep 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. \n\n## How do I override the default hostname?\n\nThe 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.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"hostname = mynewhostname\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"logdna-agent","type":"basic","title":"LogDNA Agent"}
##What is the LogDNA agent? 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. ##How do I install the LogDNA agent? Log in to [the LogDNA app](https://app.logdna.com/pages/add-host) and follow the [account-tailored add log sources instructions](https://app.logdna.com/pages/add-host). ##How do I tell the LogDNA agent what to log? 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](https://en.wikipedia.org/wiki/Glob_(programming)) by editing **/etc/logdna.conf**. For example: [block:code] { "codes": [ { "code": "logdir = /var/log,/myapp/logs/+(name1|name2).log,/etc/myapp/**/*.log", "language": "text" } ] } [/block] ##Can I trust the LogDNA agent? Absolutely! But if you ever want to double check, you can [view the source code on GitHub](https://github.com/logdna/logdna-agent) and even build the agent yourself. If you have any questions or feedback, email us at support@logdna.com. 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](https://github.com/logdna/logdna-agent/blob/master/CONTRIBUTING.md) for more info. ## How do I use host tags? 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. [block:code] { "codes": [ { "code": "tags = mytag,myothertag,anothertag", "language": "text" } ] } [/block] 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. ## How do I override the default hostname? 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. [block:code] { "codes": [ { "code": "hostname = mynewhostname", "language": "text" } ] } [/block]