Sending logs Cloudwatch from application running on Windows Server EC2 - log in multiple files/folders

0

We have an application (off the shelf, with a time-based and feature-based licence key) running on a Windows Server EC2 instance. This application creates logs which are stored in the following directory: C:\ProgramData\MyApp\v4\Logs. In this folder there are many files with names that are {guid}.txt.

We want to feed these to Cloudwatch. We created the config.json but I wanted to ask: Does the file_path in the config.json have to be pointing to one file, and one file only? ' Is it possible to point to a folder?

{
        "logs": {
                "logs_collected": {
                        "files": {
                                "collect_list": [
                                        {
                                                **"file_path": "C:\\ProgramData\\MyApp\\v4\\Logs**",
                                                "log_group_name": "Logs-Myapp",
                                                "log_stream_name": "{instance_id}-Myapp",
                                                "retention_in_days": 180
                                        }
                                ]
                        }
                }
        }
}
Sosmit
gefragt vor 10 Monaten597 Aufrufe
1 Antwort
1
Akzeptierte Antwort

Yes you can use wildcards. So point to folder\* or *.* etc

file_path – Specifies the path of the log file to upload to CloudWatch Logs. Standard Unix glob matching rules are accepted, with the addition of ** as a super asterisk. For example, specifying /var/log/**.log causes all .log files in the /var/log directory tree to be collected. For more examples, see Glob Library. You can also use the standard asterisk as a standard wildcard. For example, /var/log/system.log* matches files such as system.log_1111, system.log_2222, and so on in /var/log. Only the latest file is pushed to CloudWatch Logs based on file modification time. We recommend that you use wildcards to specify a series of files of the same type, such as access_log.2018-06-01-01 and access_log.2018-06-01-02, but not multiple kinds of files, such as access_log_80 and access_log_443. To specify multiple kinds of files, add another log stream entry to the agent configuration file so that each kind of log file goes to a different log stream.

profile picture
EXPERTE
beantwortet vor 10 Monaten
profile picture
EXPERTE
überprüft vor 10 Monaten
profile pictureAWS
EXPERTE
überprüft vor 10 Monaten
  • Thanks Gary - not sure how I missed it but I found it now that you said "from the docs." Appreciate it

  • Anytime no probs. Good luck.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen