first defintion
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
new file mode 100644
index 0000000..6c9d57c
--- /dev/null
+++ b/CHANGELOG.rst
@@ -0,0 +1,6 @@
+heka-formula
+==============
+
+0.0.1 (2015-08-03)
+
+- Initial formula setup
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..6f2b42f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,13 @@
+Copyright (c) 2014-2015 tcp cloud a.s.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..c8749d6
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,30 @@
+
+============
+Heka Formula
+============
+
+Heka is an open source stream processing software system developed by Mozilla. Heka is a Swiss Army Knife type tool for data processing
+
+Sample pillars
+==============
+
+.. code-block:: yaml
+
+    heka:
+      router:
+        enabled: true
+        bind:
+          address: 0.0.0.0
+          port: 4352
+        inputs:
+        ...
+        outputs:
+          engine: elasticsearch
+          host: localhost
+          port: 9200
+
+
+Read more
+=========
+
+* https://hekad.readthedocs.org/en/latest/index.html
\ No newline at end of file
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..8a9ecc2
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.0.1
\ No newline at end of file
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..3ed5139
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+salt-formula-heka (0.1) trusty; urgency=medium
+
+  * Initial release
+
+ -- Jan Kaufman <jan.kaufman@tcpcloud.eu>  Thu, 13 Aug 2015 23:23:41 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..ed8d832
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,15 @@
+Source: salt-formula-heka
+Maintainer: Jan Kaufman <jan.kaufman@tcpcloud.eu>
+Section: admin
+Priority: optional
+Build-Depends: debhelper (>= 9)
+Standards-Version: 3.9.6
+Homepage: http://www.tcpcloud.eu
+Vcs-Browser: https://github.com/tcpcloud/salt-formula-heka
+Vcs-Git: https://github.com/tcpcloud/salt-formula-heka.git
+
+Package: salt-formula-heka
+Architecture: all
+Depends: ${misc:Depends}, salt-master, reclass
+Description: Heka Salt formula
+ Install and configure Heka server and client.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..971f937
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,15 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: salt-formula-heka
+Upstream-Contact: Jan Kaufman <jan.kaufman@tcpcloud.eu>
+Source: https://github.com/tcpcloud/salt-formula-heka
+
+Files: *
+Copyright: 2014-2015 tcp cloud
+License: Apache-2.0
+  Copyright (C) 2014-2015 tcp cloud
+  .
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  .
+  On a Debian system you can find a copy of this license in
+  /usr/share/common-licenses/Apache-2.0.
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..d585829
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1,3 @@
+README.rst
+CHANGELOG.rst
+VERSION
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000..12adfe7
--- /dev/null
+++ b/debian/install
@@ -0,0 +1,2 @@
+heka/*             /usr/share/salt-formulas/env/heka/
+metadata/service/*      /usr/share/salt-formulas/reclass/service/heka/
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..abde6ef
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,5 @@
+#!/usr/bin/make -f
+
+%:
+	dh $@
+
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/heka/files/00-hekad.toml b/heka/files/00-hekad.toml
new file mode 100644
index 0000000..e3e130f
--- /dev/null
+++ b/heka/files/00-hekad.toml
@@ -0,0 +1,54 @@
+{%- from "heka/map.jinja" import router with context -%}
+
+[hekad]
+maxprocs = 2
+
+[RstEncoder]
+
+[DashboardOutput]
+ticker_interval = 120
+
+[ESJsonEncoder]
+index = "logfile-%{%Y.%m.%d}"
+type_name = "syslog-%{Hostname}"
+    [ESJsonEncoder.field_mappings]
+    timestamp = "@timestamp"
+    Severity = "level"
+
+{%- for output_name, output in router.output.iteritems() %}
+
+{%- if output.engine == "elasticsearch" -%}
+
+[ElasticSearchOutput]
+message_matcher = "TRUE"
+server = "http://{{ output.host }}:{{ output.port }}"
+flush_interval = 5000
+flush_count = 10
+encoder = "ESJsonEncoder"
+#encoder = "ESLogstashV0Encoder"
+#encoder = "es_payload"
+
+[ElasticSearchOutput.buffering]
+max_file_size = 268435456
+
+{%- endif -%}
+
+{%- endfor -%}
+
+{%- for input_name, input in router.input.iteritems() %}
+
+
+{%- if input.engine == "amqp" -%}
+
+[AMQPInput]
+type = "AMQPInput"
+url = "amqp://{{ input.user }}:{{ input.password }}@{{ input.host }}/"
+exchange = "logs"
+exchange_type = "fanout"
+prefetch_count = 20
+decoder = "ProtobufDecoder"
+splitter = "HekaFramingSplitter"
+
+{%- endif -%}
+
+{%- endfor -%}
diff --git a/heka/init.sls b/heka/init.sls
new file mode 100644
index 0000000..3a897e9
--- /dev/null
+++ b/heka/init.sls
@@ -0,0 +1,5 @@
+
+include:
+{% if pillar.heka.router is defined %}
+- heka.router
+{% endif %}
diff --git a/heka/map.jinja b/heka/map.jinja
new file mode 100644
index 0000000..332ca91
--- /dev/null
+++ b/heka/map.jinja
@@ -0,0 +1,15 @@
+
+{% set router = salt['grains.filter_by']({
+    'Debian': {
+        'pkgs': ["heka"],
+        'service': 'heka',
+        'input': {},
+        'output': {}
+    },
+    'RedHat': {
+        'pkgs': ["heka"],
+        'service': 'heka',
+        'input': {},
+        'output': {}
+    },
+}, merge=salt['pillar.get']('heka:router')) %}
\ No newline at end of file
diff --git a/heka/router.sls b/heka/router.sls
new file mode 100644
index 0000000..b8b7666
--- /dev/null
+++ b/heka/router.sls
@@ -0,0 +1,23 @@
+{%- from "heka/map.jinja" import router with context %}
+{%- if router.enabled %}
+
+heka_packages:
+  pkg.installed:
+  - names: {{ heka.pkgs }}
+
+/etc/heka/conf.d/00-hekad.toml:
+  file.managed:
+  - source: salt://heka/files/00-hekad.toml
+  - template: jinja
+  - mode: 755
+  - require:
+    - pkg: heka_packages
+  - watch_in:
+    - service: heka_service
+
+heka_service:
+  service.running:
+  - enable: true
+  - name: {{ router.service }}
+
+{%- endif %}
\ No newline at end of file
diff --git a/metadata/service/router/single.yml b/metadata/service/router/single.yml
new file mode 100644
index 0000000..9bce095
--- /dev/null
+++ b/metadata/service/router/single.yml
@@ -0,0 +1,25 @@
+applications:
+- heka
+_param:
+  heka_router_output_host: localhost
+  heka_router_input_host: localhost
+  heka_router_input_user: guest
+  heka_router_input_password: guest
+parameters:
+  heka:
+    router:
+      enabled: true
+    bind:
+      address: 0.0.0.0
+      port: 4352
+    output:
+      elasticsearch01:
+        engine: elasticsearch
+        host: ${_param:heka_router_output_host}
+        port: 9200
+    input:
+      rabbitmq:
+        engine: amqp
+        host: ${_param:heka_router_input_host}
+        user: ${_param:heka_router_input_user}
+        password: ${_param:heka_router_input_password}
\ No newline at end of file