Skip to content

Commit

Permalink
manage script_sources, too
Browse files Browse the repository at this point in the history
  • Loading branch information
Liberty Young committed Aug 31, 2015
1 parent 45b7f18 commit dfd4fa8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
7 changes: 7 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ sumologic:
name: syslog
path: "/var/log/syslog"
category: linux_apps_logs
script_sources:
- script1:
name: script1
description: some description
commands: ["/bin/foo", "/bin/bar"]
cronExpression: "* * * * * "
category: scripts
28 changes: 26 additions & 2 deletions sumologic/files/sources.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{% set sumo_tz = salt['pillar.get']('sumologic:timezone', "America/Los_Angeles") %}
{% set sources = salt['pillar.get']('sumologic:file_sources', {}) %}
{% set f_sources = salt['pillar.get']('sumologic:file_sources', {}) %}
{% set s_sources = salt['pillar.get']('sumologic:script_sources') %}

{
"api.version": "v1",
"sources": [
{% for source in sources %}
{% for source in f_sources %}
{
"sourceType" : "LocalFile",
"name": "{{ source["name"]}}",
Expand All @@ -20,5 +22,27 @@
"blacklist": []
}{% if not loop.last %},{% endif %}
{% endfor %}
{% if s_sources %}
,
{% for source in s_sources %}
{
"sourceType" : "Script",
"commands": {{ source.commands}},
"cronExpression": "{{ source.cronExpression}}",
"workingDir": "/tmp",
"timeout": 60,
"name" : "{{ source.name }}",
"description" : "{{ source.description }}",
"category" : "{{ source.category}}",
"timeZone": "{{ sumo_tz }}",
"automaticDateParsing": true,
"multilineProcessingEnabled": true,
"useAutolineMatching": true,
"manualPrefixRegexp": "",
"forceTimeZone": false,
"defaultDateFormat": "dd/MMM/yyyy HH:mm:ss"
}{% if not loop.last %},{% endif %}
{% endfor %}
{% endif %}
]
}

0 comments on commit dfd4fa8

Please sign in to comment.