Skip to content

Filebeat Redis prospector type#4180

Merged
tsg merged 1 commit intoelastic:masterfrom
ruflin:fb-redis-approach
May 26, 2017
Merged

Filebeat Redis prospector type#4180
tsg merged 1 commit intoelastic:masterfrom
ruflin:fb-redis-approach

Conversation

@ruflin
Copy link
Copy Markdown
Contributor

@ruflin ruflin commented May 3, 2017

This PR adds a new prospector type which reads the slowlog from redis. This slowlog is not in a file but in memory in redis. Because of this filebeat connects to redis and reads out the slowlog. It is important to note that the slow log size is limited in redis that is why after fetching the events from the slowlog filebeat resets the slow log.

Example event looks as following:

{
  "@timestamp": "2017-05-16T06:27:17.000Z",
  "beat": {
    "hostname": "ruflin",
    "name": "ruflin",
    "read_timestamp": "2017-05-16T06:27:19.275Z",
    "version": "6.0.0-alpha2"
  },
  "message": "SET hello world",
  "redis": {
    "slowlog": {
      "args": [
        "world"
      ],
      "cmd": "SET",
      "duration": {
        "us": 11
      },
      "id": 38,
      "key": "hello"
    }
  }
}

All args are combined in the "message" field output for easy retrieval.

@ruflin ruflin added discuss Issue needs further discussion. Filebeat Filebeat in progress Pull request is currently in progress. labels May 3, 2017
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported type Config should have comment or be unexported

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
package comment should be of the form "Package redis ..."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported type Harvester should have comment or be unexported

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method Harvester.Start should have comment or be unexported

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported type Prospector should be of the form "Prospector ..." (with optional leading article)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported function NewProspector should be of the form "NewProspector ..."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest somehow making it more clear that this is strictly about slow logs. People might assume that it's a general Redis input.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a tricky one. Thinking more about the prospectors I get the impression we will have prospector with multiple harvester types potentially (similar to what we have in metricbeat). For example in file there could be file.csv or file.xml. What if we not only have slowlog for redis? But TBH I'm not sure yet what we should do here. This could also well be overengineered and we will not need it.

For the moment I think I fix the above with call it Redis slowlog prospector in the docs but still redis as the prospector type.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use 2s or 5s as an example. 100 micros might affect the Redis performance, so we should be careful.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small typo: "it can be configured"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, good question. In the end it needs to be the event timestamp, but I see two options:

  • live it like that here, but replace it in the FB redis module
  • already set it hear and also set beat.read_timestamp

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided for option 2 for the moment. The reasons is that I think it most cases that is what people expect in @timestamp here. So also without postprocessing in ingest, the data is already correct.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess people can use drop_fields if they don't want it.

@ruflin ruflin mentioned this pull request May 10, 2017
14 tasks
@ruflin ruflin force-pushed the fb-redis-approach branch 2 times, most recently from 456e2e0 to 9ba6162 Compare May 15, 2017 11:25
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported method Forwarder.Forward should be of the form "Forward ..."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported type Harvester should have comment or be unexported

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported function NewHarvester should have comment or be unexported

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method Harvester.Start should have comment or be unexported

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method Harvester.Stop should have comment or be unexported

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method Harvester.ID should have comment or be unexported

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method Prospector.Stop should have comment or be unexported

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method Prospector.Wait should have comment or be unexported

@ruflin ruflin force-pushed the fb-redis-approach branch 5 times, most recently from 4a55634 to 36be381 Compare May 16, 2017 06:33
@ruflin ruflin changed the title [WIP] Filebeat Redis prospector type Filebeat Redis prospector type May 16, 2017
@ruflin ruflin added review and removed discuss Issue needs further discussion. labels May 16, 2017
@ruflin
Copy link
Copy Markdown
Contributor Author

ruflin commented May 16, 2017

@tsg Ready for an other look. I think we are at the point now where we have to decide on what to do with it :-)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported var ValidType should be of the form "ValidType ..."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
comment on exported method Harvester.Run should be of the form "Run ..."

@ruflin ruflin force-pushed the fb-redis-approach branch 2 times, most recently from e021c74 to 8a8caba Compare May 19, 2017 14:26
@ruflin
Copy link
Copy Markdown
Contributor Author

ruflin commented May 19, 2017

@dedemorton So far I only added the minimial options of docs for this = almost nothing. The reason is that this kind of challenges our existing doc structure we have for prospectors. So far the 2 prospectors shared 95% of the config options. With this change, they can be very different. I'm thinking if we should start to organise docs similar to what we do with the modules and have a block for each prospector type. I will need your help here and suggest we will only tackle this after merging the PR.

@dedemorton
Copy link
Copy Markdown
Contributor

@ruflin I remember you mentioned this problem awhile back ago in an email, but I haven't had a chance to follow up with you. What release are we targeting for this PR?

@ruflin
Copy link
Copy Markdown
Contributor Author

ruflin commented May 22, 2017

@dedemorton Not sure if I mentioned that before (but could be). It's not urgent. If it happens, somewhere around 6.0

@ruflin ruflin force-pushed the fb-redis-approach branch from 8a8caba to 1a29277 Compare May 22, 2017 13:03
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small typo on "ofr".

This PR adds a new prospector type which reads the slowlog from redis. This slowlog is not in a file but in memory in redis. Because of this filebeat connects to redis and reads out the slowlog. It is important to note that the slow log size is limited in redis that is why after fetching the events from the slowlog filebeat resets the slow log.

Example event looks as following:

```
{
  "@timestamp": "2017-05-16T06:27:17.000Z",
  "beat": {
    "hostname": "ruflin",
    "name": "ruflin",
    "read_timestamp": "2017-05-16T06:27:19.275Z",
    "version": "6.0.0-alpha2"
  },
  "message": "SET hello world",
  "redis": {
    "slowlog": {
      "args": [
        "world"
      ],
      "cmd": "SET",
      "duration": {
        "us": 11
      },
      "id": 38,
      "key": "hello"
    }
  }
}
```

All args are combined in the "message" field output for easy retrieval.
@ruflin ruflin force-pushed the fb-redis-approach branch from 1a29277 to e3e6c2f Compare May 26, 2017 06:41
@ruflin
Copy link
Copy Markdown
Contributor Author

ruflin commented May 26, 2017

@tsg New version pushed
@dedemorton I created #4398 as a follow up Github issue for the docs.

@ruflin ruflin removed the in progress Pull request is currently in progress. label May 26, 2017
@tsg tsg merged commit 4ab7848 into elastic:master May 26, 2017
@ruflin ruflin deleted the fb-redis-approach branch May 26, 2017 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants