Giter Club home page Giter Club logo

opsworks-logstash's Introduction

This project is no longer maintained.

If you're interested in taking it over, we'd love to hear from you. Email [email protected], or check out one of its maintained forks.


A complete Logstash stack on AWS OpsWorks

UPDATE: I wrote a blog post that will help you set this up.

This is a bunch of cookbooks that will allow you to run a complete Logstash setup on a scalable AWS OpsWorks stack. At Springest we use it to ship from 250 to about 1k log entries per second, depending on the RPM on our 18 servers.

kibana A screenshot of Kibana3, included in the cookbooks.

The stack's layers

layers A screenshot of the layers in AWS OpsWorks

  • A RabbitMQ cluster layer (Ubuntu) – Agents wil ship their logs to this cluster and the Logstash server cluster uses it as an input source.
  • An ElasticSearch cluster layer (Amazon Linux) – All log messages are stored and indexed here.
  • A LogStash cluster layer (Ubuntu) – Takes the messages from the RabbitMQ fanout and puts them into ElasticSearch.
  • A Kibana server (Ubuntu) - An Angular.js interface on top of ElasticSearch to search, graph etc.

Setting up your stack

  • Set git://github.com/Springest/opsworks-logstash.git as a repository URL for your custom cookbooks.
  • Use the following Chef custom JSON:
{
    "chef_environment": "production",
    "elasticsearch": {
        "cluster": {
            "name": "logstash"
        },
        "basic_auth": {
            "user": "<es username here>",
            "password": "<es password here>"
        }
    },
    "rabbitmq": {
        "cluster": true,
        "erlang_cookie": "<any random alphanumeric string will do>"
    },
    "rabbitmq_cluster": {
        "user": "<rabbitmq username here>",
        "password": "<rabbitmq password here>"
    },
    "kibana": {
        "webserver": "nginx",
        "webserver_hostname": "<your kibana domain, eg: kibana.example.com>",
        "web_user": "<kibana username here>",
        "web_password": "<kibana password here>",
        "es_port": "9200",
        "es_role": "elasticsearch",
        "es_server": "<es loadbalancer address here>",
        "es_user": "<es username here>",
        "es_password": "<es password here>"
    },
    "logstash": {
        "elasticsearch_cluster": "logstash",
        "server": {
            "install_rabbitmq": false,
            "enable_embedded_es": false,
            "elasticsearch_role": "elasticsearch",
            "inputs": [
                {
                    "rabbitmq": {
                        "exchange": "rawlogs",
                        "user": "<rabbitmq username here>",
                        "password": "<rabbitmq password here>",
                        "host": "<IP or LB address of your rabbitmq server/cluster>",
                        "type": "all"
                    }
                }
            ]
        }
    }
}

Configure Custom Chef recipes

ElasticSearch

elasticsearch recipes

Kibana

kibana recipes

Logstash

logstash recipes

RabbitMQ

rabbitmq recipes

Contribute

  • Fork the project
  • Create a feature branch
  • Fix the code
  • Create a pull request

Thanks to

All of these people have made our lives a little better by writing great software.

The contributors at these projects:

And the people who wrote these cookbooks:

And the guys at Opscode and their contributors for Chef and cookbooks like:

And last but not least:

opsworks-logstash's People

Contributors

lizgene avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

opsworks-logstash's Issues

Filters

I'm having trouble getting my filter into the custom.json, filter as follows

filter {

  if "input_heroku_syslog" in [tags] {
    grok {
      match => ["message", "%{SYSLOG5424PRI}%{NONNEGINT:syslog5424_ver} +(?:%{TIMESTAMP_ISO8601:timestamp}|-) +(?:%{HOSTNAME:heroku
_drain_id}|-) +(?:%{WORD:heroku_source}|-) +(?:%{DATA:heroku_dyno}|-) +(?:%{WORD:syslog5424_msgid}|-) +(?:%{SYSLOG5424SD:syslog5424
_sd}|-|) +%{GREEDYDATA:heroku_message}"]
    }
    mutate { rename => ["heroku_message", "message"] }
    kv { source => "message" }
    syslog_pri { syslog_pri_field_name => "syslog5424_pri" }
  }
}

Basically how do i get my conditional into the custm.json?

Could not satisfy version constraints for: yum

This error pops up whenever attempting to follow this guide. I haven't been able to figure out exactly where this yum requirement is coming from.

[2014-06-16T18:16:53+00:00] INFO: Forking chef instance to converge...
[2014-06-16T18:16:53+00:00] INFO: *** Chef 11.10.4 ***
[2014-06-16T18:16:53+00:00] INFO: Chef-client pid: 7321
[2014-06-16T18:16:55+00:00] INFO: Setting the run_list to ["opsworks_custom_cookbooks::load", "opsworks_custom_cookbooks::execute"] from JSON
[2014-06-16T18:16:55+00:00] WARN: Run List override has been provided.
[2014-06-16T18:16:55+00:00] WARN: Original Run List: [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
[2014-06-16T18:16:55+00:00] WARN: Overridden Run List: [recipe[opsworks_initial_setup], recipe[ssh_host_keys], recipe[ssh_users], recipe[mysql::client], recipe[dependencies], recipe[ebs], recipe[opsworks_ganglia::client], recipe[opsworks_stack_state_sync], recipe[rabbitmq_cluster], recipe[deploy::default], recipe[test_suite], recipe[opsworks_cleanup]]
[2014-06-16T18:16:55+00:00] INFO: Run List is [recipe[opsworks_initial_setup], recipe[ssh_host_keys], recipe[ssh_users], recipe[mysql::client], recipe[dependencies], recipe[ebs], recipe[opsworks_ganglia::client], recipe[opsworks_stack_state_sync], recipe[rabbitmq_cluster], recipe[deploy::default], recipe[test_suite], recipe[opsworks_cleanup]]
[2014-06-16T18:16:55+00:00] INFO: Run List expands to [opsworks_initial_setup, ssh_host_keys, ssh_users, mysql::client, dependencies, ebs, opsworks_ganglia::client, opsworks_stack_state_sync, rabbitmq_cluster, deploy::default, test_suite, opsworks_cleanup]
[2014-06-16T18:16:55+00:00] INFO: Starting Chef Run for rabbitmq1.localdomain
[2014-06-16T18:16:55+00:00] INFO: Running start handlers
[2014-06-16T18:16:55+00:00] INFO: Start handlers complete.
[2014-06-16T18:16:55+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: /reports/nodes/rabbitmq1.localdomain/runs
[2014-06-16T18:17:42+00:00] INFO: HTTP Request Returned 412 Precondition Failed: Could not satisfy version constraints for: yum

Error Resolving Cookbooks for Run List:

Missing Cookbooks:

Problems in speed-up a new instance for ElasticSearch cluster

I followed the whole procedure and once I try to start the instance for ElasticSearch layer I got the follwoing error ..

I tried starting up an Ubuntu machine (14.04 LTS) or an Amazon machine. Same error

[2014-08-03T15:48:11+00:00] INFO: Forking chef instance to converge...
[2014-08-03T15:48:12+00:00] INFO: *** Chef 11.10.4 ***
[2014-08-03T15:48:12+00:00] INFO: Chef-client pid: 6380
[2014-08-03T15:48:13+00:00] INFO: Setting the run_list to ["opsworks_custom_cookbooks::load", "opsworks_custom_cookbooks::execute"] from JSON
[2014-08-03T15:48:13+00:00] WARN: Run List override has been provided.
[2014-08-03T15:48:13+00:00] WARN: Original Run List: [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
[2014-08-03T15:48:13+00:00] WARN: Overridden Run List: [recipe[opsworks_initial_setup], recipe[ssh_host_keys], recipe[ssh_users], recipe[mysql::client], recipe[dependencies], recipe[ebs], recipe[opsworks_ganglia::client], recipe[opsworks_stack_state_sync], recipe[elasticsearch::install], recipe[elasticsearch::packages], recipe[deploy::default], recipe[test_suite], recipe[opsworks_cleanup]]
[2014-08-03T15:48:13+00:00] INFO: Run List is [recipe[opsworks_initial_setup], recipe[ssh_host_keys], recipe[ssh_users], recipe[mysql::client], recipe[dependencies], recipe[ebs], recipe[opsworks_ganglia::client], recipe[opsworks_stack_state_sync], recipe[elasticsearch::install], recipe[elasticsearch::packages], recipe[deploy::default], recipe[test_suite], recipe[opsworks_cleanup]]
[2014-08-03T15:48:13+00:00] INFO: Run List expands to [opsworks_initial_setup, ssh_host_keys, ssh_users, mysql::client, dependencies, ebs, opsworks_ganglia::client, opsworks_stack_state_sync, elasticsearch::install, elasticsearch::packages, deploy::default, test_suite, opsworks_cleanup]
[2014-08-03T15:48:13+00:00] INFO: Starting Chef Run for elastic-search2.localdomain
[2014-08-03T15:48:13+00:00] INFO: Running start handlers
[2014-08-03T15:48:13+00:00] INFO: Start handlers complete.
[2014-08-03T15:48:13+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: /reports/nodes/elastic-search2.localdomain/runs
[2014-08-03T15:48:44+00:00] INFO: HTTP Request Returned 412 Precondition Failed: Could not satisfy version constraints for: yum

Error Resolving Cookbooks for Run List:

Missing Cookbooks:

Could not satisfy version constraints for: yum

Expanded Run List:

  • opsworks_initial_setup
  • ssh_host_keys
  • ssh_users
  • mysql::client
  • dependencies
  • ebs
  • opsworks_ganglia::client
  • opsworks_stack_state_sync
  • elasticsearch::install
  • elasticsearch::packages
  • deploy::default
  • test_suite
  • opsworks_cleanup

[2014-08-03T15:48:44+00:00] ERROR: Running exception handlers
[2014-08-03T15:48:44+00:00] ERROR: Exception handlers complete
[2014-08-03T15:48:44+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache/chef-stacktrace.out
[2014-08-03T15:48:44+00:00] ERROR: 412 "Precondition Failed"
[2014-08-03T15:48:44+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

And here is the Stacktrace:

Generated at 2014-08-03 15:46:22 +0000
Net::HTTPServerException: 412 "Precondition Failed"
/opt/aws/opsworks/local/lib/ruby/2.0.0/net/http/response.rb:119:in error!' /opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/lib/chef/http.rb:140:inrequest'
/opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/lib/chef/http.rb:121:in post' /opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/lib/chef/policy_builder/expand_node_object.rb:170:insync_cookbooks'
/opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/lib/chef/policy_builder/expand_node_object.rb:68:in setup_run_context' /opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/lib/chef/client.rb:252:insetup_run_context'
/opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/lib/chef/client.rb:413:in do_run' /opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/lib/chef/client.rb:200:inblock in run'
/opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/lib/chef/client.rb:194:in fork' /opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/lib/chef/client.rb:194:inrun'
/opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/lib/chef/application.rb:215:in run_chef_client' /opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/lib/chef/application/client.rb:314:inblock in run_application'
/opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/lib/chef/application/client.rb:306:in loop' /opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/lib/chef/application/client.rb:306:inrun_application'
/opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/lib/chef/application.rb:66:in run' /opt/aws/opsworks/releases/20140620104520_315/vendor/bundle/ruby/2.0.0/gems/chef-11.10.4/bin/chef-client:26:in<top (required)>'
/opt/aws/opsworks/current/bin/chef-client:16:in load' /opt/aws/opsworks/current/bin/chef-client:16:in

'

NoMethodError: ruby_block[Compile Custom OpsWorks Run List] (opsworks_custom_cookbooks::execute line 3) had an error

I am getting an error on Logstash instance. sorry, I am new to chef and ELK
Can you please advise on how to get past this error? I have all the other layers working on my opsworks stack except logstash
This error is when I use logstash::default recipe.
Am I supposed to use logstash::server recipe? I get a ResourceNotFound error when I do that

Here is the stacktrace

[2014-09-08T03:13:53+00:00] FATAL: Stacktrace dumped to /opt/aws/opsworks/releases/20140806152451_231/chef-stacktrace.out
[2014-09-08T03:13:53+00:00] DEBUG: NoMethodError: ruby_block[Compile Custom OpsWorks Run List](opsworks_custom_cookbooks::execute line 3) had an error: NoMethodError: undefined method conf' for Chef::Resource::Template /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/resource.rb:293:inmethod_missing'
/opt/aws/opsworks/releases/20140806152451_231/site-cookbooks/logstash/recipes/server.rb:13:in from_file' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/dsl/recipe.rb:71:ininstance_eval'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/dsl/recipe.rb:71:in method_missing' /opt/aws/opsworks/releases/20140806152451_231/site-cookbooks/logstash/recipes/server.rb:10:infrom_file'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/cookbook_version.rb:346:in load_recipe' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/run_context.rb:151:inload_recipe'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/run_context.rb:132:in include_recipe' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/run_context.rb:131:ineach'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/run_context.rb:131:in include_recipe' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/dsl/include_recipe.rb:26:ininclude_recipe'
/opt/aws/opsworks/releases/20140806152451_231/site-cookbooks/logstash/recipes/default.rb:51:in from_file' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/cookbook_version.rb:346:inload_recipe'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/run_context.rb:151:in load_recipe' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:139:incompile_recipes'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:137:in each' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:137:incompile_recipes'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:74:in compile' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/run_context.rb:86:inload'
/opt/aws/opsworks/releases/20140806152451_231/cookbooks/opsworks_custom_cookbooks/recipes/execute.rb:15:in from_file' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/provider/ruby_block.rb:33:incall'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/provider/ruby_block.rb:33:in action_run' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/mixin/why_run.rb:52:incall'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/mixin/why_run.rb:52:in add_action' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/provider.rb:151:inconverge_by'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/provider/ruby_block.rb:32:in action_run' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/provider.rb:114:insend'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/provider.rb:114:in run_action' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/resource.rb:617:inrun_action'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/runner.rb:50:in run_action' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/runner.rb:82:inconverge'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/runner.rb:82:in each' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/runner.rb:82:inconverge'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/resource_collection.rb:94:in execute_each_resource' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:incall'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in call_iterator_block' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:instep'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:104:in iterate' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:ineach_with_index'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/resource_collection.rb:92:in execute_each_resource' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/runner.rb:81:inconverge'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/client.rb:404:in converge' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/client.rb:469:indo_run'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/client.rb:200:in run' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/application.rb:190:inrun_chef_client'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/application/solo.rb:239:in run_application' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/application/solo.rb:231:inloop'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/application/solo.rb:231:in run_application' /opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/../lib/chef/application.rb:73:inrun'
/opt/aws/opsworks/releases/20140806152451_231/vendor/gems/chef-11.4.4/bin/chef-solo:25
/opt/aws/opsworks/current/bin/chef-solo:16:in load' /opt/aws/opsworks/current/bin/chef-solo:16 [2014-09-08T03:13:53+00:00] FATAL: NoMethodError: ruby_block[Compile Custom OpsWorks Run List] (opsworks_custom_cookbooks::execute line 3) had an error: NoMethodError: undefined methodconf' for Chef::Resource::Template

basic-auth versioning

Hi,
Apologies since I'm still getting up to speed with Chef, but how did you deal with getting the correct version of the elasticsearch http auth plugin so that you can use Kibana and ElasticSearch 1.x.x? The issue I'm running into (I believe) is that by bumping to Elasticsearch 1.0.1, I'm breaking the auth plugin
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.