Skip to content

Commit

Permalink
Support managing localFile sources with Salt Pillars
Browse files Browse the repository at this point in the history
  • Loading branch information
Liberty Young committed Aug 27, 2015
1 parent 6479880 commit 45b7f18
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
11 changes: 11 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,14 @@
sumologic_install:
accessid: 'access_id'
accesskey: 'accesskey'

sumologic:
file_sources:
- auth:
name: auth_log
path: "/var/log/auth*"
category: linux_apps_logs
- local_syslog:
name: syslog
path: "/var/log/syslog"
category: linux_apps_logs
26 changes: 21 additions & 5 deletions sumologic/files/sources.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
{% set sumo_tz = salt['pillar.get']('sumologic:timezone', "America/Los_Angeles") %}
{% set sources = salt['pillar.get']('sumologic:file_sources', {}) %}
{
"api.version": "v1",
"installer": {
"name": "None",
"order": 1000,
"description": "Do not install sources"
"sources": [
{% for source in sources %}
{
"sourceType" : "LocalFile",
"name": "{{ source["name"]}}",
"pathExpression": "{{ source["path"]}}",
"category": "{{source["category"]}}",
"hostName": "{{salt['grains.get']('id')}}",
"useAutolineMatching": false,
"multilineProcessingEnabled": false,
"automaticDateParsing": true,
"timeZone": "{{ sumo_tz }}",
"forceTimeZone": false,
"defaultDateFormat": "dd/MMM/yyyy HH:mm:ss",
"filters": [],
"blacklist": []
}{% if not loop.last %},{% endif %}
{% endfor %}
]
}
}
1 change: 1 addition & 0 deletions sumologic/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- user: root
- group: root
- mode: 400
- template: jinja
- source: salt://sumologic/files/sources.json

/etc/sumo.conf:
Expand Down

0 comments on commit 45b7f18

Please sign in to comment.