Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a setting to disable source output in slowlog #12655

Closed
wants to merge 3 commits into from
Closed

Adds a setting to disable source output in slowlog #12655

wants to merge 3 commits into from

Conversation

bookshelfdave
Copy link
Contributor

When logging large documents via slowlog, setting index.slow_logging.source
to false prevents the source from being displayed.

Closes #4485

I don't see any tests for slowlog, so I used these steps to manually test:

curl -XPUT 'http://localhost:9200/bar'

# don't log source
curl -XPUT 'localhost:9200/bar/_settings' -d '
{
    "index" : {
        "slow_logging.source" : false
    }
}'

# bump the index threshold to 0s
curl -XPUT 'http://localhost:9200/bar/_settings' -d '
{
    "index.search.slowlog.threshold.query.warn" : "10s", 
    "index.search.slowlog.threshold.fetch.debug": "500ms", 
    "index.indexing.slowlog.threshold.index.info": "0ms" 
}'



curl -XPUT 'http://localhost:9200/bar/tweet/2' -d '
{
    "user": "kimchy",
    "postDate": "2009-11-15T13:12:00",
    "message": "Trying out Elasticsearch, so far so good?"
}'


curl -XPUT 'localhost:9200/bar/_settings' -d '
{
    "index" : {
        "slow_logging.source" : true
    }
}'


curl -XPUT 'http://localhost:9200/bar/tweet/3' -d '
{
    "user": "kimchy",
    "postDate": "2009-11-15T13:12:00",
    "message": "Foo bar baz"
}'

When logging large documents via slowlog, setting index.slow_logging.source
to false prevents the source from being displayed.

Closes #4485
@@ -172,8 +172,10 @@ public static State fromString(String state) {
public static final String SETTING_LEGACY_ROUTING_USE_TYPE = "index.legacy.routing.use_type";
public static final String SETTING_DATA_PATH = "index.data_path";
public static final String SETTING_SHARED_FS_ALLOW_RECOVERY_ON_ANY_NODE = "index.shared_filesystem.recover_on_any_node";
public static final String SETTING_SLOW_LOGGING_SOURCE ="index.slow_logging.source";
Copy link
Member

Choose a reason for hiding this comment

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

Space after the equals. Its a silly small change but it helps my eyes.

@@ -388,6 +392,14 @@ public int getTotalNumberOfShards() {
return totalNumberOfShards();
}

public boolean slowLoggingSource() {
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need both the getter style and the bare style?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

probably not. I copied the style of the other settings

Copy link
Member

Choose a reason for hiding this comment

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

Oh thats cool then. Icky but cool.

@nik9000
Copy link
Member

nik9000 commented Aug 4, 2015

I wonder if it'd be possible to make the setting true/false/some_number_of_characters. If the document has more than that many characters then you could just truncate it. You have to figure out truncation in utf-16 unicode characters but I imagine Lucene has a function for that. I like truncating because usually the neat parts of the document are at the front....

On the other hand if this gets any more complicated than it is it'll really need testing. Could you maybe make a constructor for IndexingSlowLog that takes an ESLog as a parameter? Then you could mock it and get the results. Or something like that.

@jpountz
Copy link
Contributor

jpountz commented Aug 6, 2015

+1 to making it take an integer instead of a boolean and truncating. Lucene doesn't have utility methods for that, but Java has: we could just read one more UTF16 char if the last one happens to be a high surrogate?

@nik9000
Copy link
Member

nik9000 commented Aug 6, 2015

Ah yes. I remember that. I was thinking about combining codepoints too but
we might be able to ignore those.
On Aug 6, 2015 5:40 AM, "Adrien Grand" notifications@github.com wrote:

+1 to making it take an integer instead of a boolean and truncating.
Lucene doesn't have utility methods for that, but Java has: we could just
read one more UTF16 char if the last one happens to be a high surrogate
http://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isHighSurrogate%28char%29
?


Reply to this email directly or view it on GitHub
#12655 (comment)
.

@nik9000 nik9000 assigned nik9000 and unassigned nik9000 Aug 7, 2015
@nik9000
Copy link
Member

nik9000 commented Aug 7, 2015

I'll take this in a few days if no one else does.

@nik9000 nik9000 self-assigned this Aug 10, 2015
@nik9000
Copy link
Member

nik9000 commented Aug 11, 2015

Obsoleted by #12806.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue low hanging fruit help wanted adoptme
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants