Skip to content

Instantly share code, notes, and snippets.

{
"post_id" : 1,
"post_title" : "Logstash é vida",
"post_content" : "<p>Vejá só como é facil!...</p>",
"author_name" : "Samir Varandas",
"text_comments" : ["Achei top", "Achei péssimo"]
}
output {
#elastic search output plugin
elasticsearch {
#url da API do Elastic
hosts => ["${ELASTICSEARCH_HOST}"]
#chave de autenticação
api_key=> ["${ELASTICSEARCH_API_KEY}"]
#nome do index para fazer o upsert (faz update se existir o post de post_id caso contrário o insere)
index => "idx_posts"
#faz uma operação de update no registro do Elastic
filter {
#faz uma operação de aggregate (semelhante a um group by)
aggregate {
#vamos agrupar pelo id do post
task_id => "%{post_id}"
#e vamos mapear o evento dessa forma
code => "
map['post_id'] = event.get('post_id')
map['post_title'] = event.get('post_title')
map['post_content'] = event.get('post_content')
{
"post_id" : 1,
"post_title" : "Logstash é vida",
"post_content" : "<p>Vejá só como é facil!...</p>",
"author_name" : "Samir Varandas",
"text_comments" : ["Achei top", "Achei péssimo"]
}
input {
jdbc {
#configurações de conexão de banco usando jdbc driver
jdbc_driver_library => "${LOGSTASH_JDBC_DRIVER_JAR_LOCATION}"
jdbc_driver_class => "${LOGSTASH_JDBC_DRIVER}"
jdbc_connection_string => "${LOGSTASH_JDBC_URL}"
jdbc_user => "${LOGSTASH_JDBC_USERNAME}"
jdbc_password => "${LOGSTASH_JDBC_PASSWORD}"
#url para guardar arquivo de last run com dados do cursor
last_run_metadata_path=> "/usr/share/logstash/data/.logstash_jdbc_last_run"
@samirvarandas
samirvarandas / index.html
Last active May 30, 2018 19:05
Script net customer chat fb plugin 30-05-2018
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Document</title>
</head>
<body>
<!-- Incluir onclick="showFB()" no link assine via chat -->
<button onclick="showFB()">Exibir chat</button>
{
"status": true,
"event":
{
"date": "08/07/2014",
"weddings": [
{
"id": 7490,
"remaining_time": 1,
"name": "Jefferson Oliveira & Karla Oliveira"